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
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']
}
self.send_confirmation_email('Confirm account creation at %s' % current_site.name, user.email, self.register_confirmation_email, context)
messages.add_message(request, messages.SUCCESS, 'An email has been sent to %s with details on activating your account.' % user.email, fail_silently=True)
- return HttpResponseRedirect('')
+ return HttpResponseRedirect(node.get_absolute_url())
else:
form = RegistrationForm()