Minor bugfix: moved ConstantEmbedNode DoesNotExist reraising so that it actually...
[philo.git] / contrib / waldo / forms.py
index 50e1fa6..18c22a4 100644 (file)
@@ -1,8 +1,11 @@
 from datetime import date
 from django import forms
 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.forms import AuthenticationForm, UserCreationForm
+from django.contrib.auth.models import User
 from django.core.exceptions import ValidationError
 from django.utils.translation import ugettext_lazy as _
 from django.core.exceptions import ValidationError
 from django.utils.translation import ugettext_lazy as _
+from philo.contrib.waldo.tokens import REGISTRATION_TIMEOUT_DAYS
 
 
 LOGIN_FORM_KEY = 'this_is_the_login_form'
 
 
 LOGIN_FORM_KEY = 'this_is_the_login_form'
@@ -17,6 +20,13 @@ class EmailInput(forms.TextInput):
 
 class RegistrationForm(UserCreationForm):
        email = forms.EmailField(widget=EmailInput)
 
 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']
        
        def clean_username(self):
                username = self.cleaned_data['username']