X-Git-Url: http://git.ithinksw.org/philo.git/blobdiff_plain/d1fa7611b6254a03dc07979b28f66aa3439efffb..8c6ffb8e54f201a0fb7776fdd865bbbb3d42a29b:/contrib/waldo/forms.py diff --git a/contrib/waldo/forms.py b/contrib/waldo/forms.py index 4465a99..18c22a4 100644 --- a/contrib/waldo/forms.py +++ b/contrib/waldo/forms.py @@ -1,5 +1,6 @@ from datetime import date from django import forms +from django.conf import settings from django.contrib.auth.forms import AuthenticationForm, UserCreationForm from django.contrib.auth.models import User from django.core.exceptions import ValidationError @@ -19,6 +20,13 @@ class EmailInput(forms.TextInput): class RegistrationForm(UserCreationForm): email = forms.EmailField(widget=EmailInput) + try: + from recaptcha_django import ReCaptchaField + except ImportError: + pass + else: + if 'recaptcha_django.middleware.ReCaptchaMiddleware' in settings.MIDDLEWARE_CLASSES: + recaptcha = ReCaptchaField() def clean_username(self): username = self.cleaned_data['username']