Integrate reCAPTCHA to a Django Form Model
I needed an implementation to prevent spamming programs and bots from using the contact form. I have decided to used reCAPTCHA since it also helps to digitize scanned text materials. A google search on 'django recaptcha' led me to marco rucci's blogsite.
I followed the instructions and created the source files based on the article. I managed to get the reCAPTCHA rendered and running, but I had an issue with its out of the box solution. The default red CSS theme uses a table class style that does not go well with my site's css layout. Fortunately, the reCAPTCHA API allows one to customize the way the captcha components are displayed. I hacked the downloaded python recaptcha-clientto include another flag to use custom theme in its displayhtml function. I had also updated marco rucci's widgets.py file to include the new use_custom_theme variable flag.
Note: The project settings file needs to include a new variable called RECAPTCHA_USE_CUSTOM_THEME (True to use custom theme or False to use the default red theme).Here are the attached code changes and please leave some comments if you have any.