Removed philo.models.Tag entry from the docs.
[philo.git] / philo / contrib / waldo / forms.py
index 4cc9874..eb53598 100644 (file)
@@ -12,10 +12,18 @@ from philo.contrib.waldo.tokens import REGISTRATION_TIMEOUT_DAYS
 
 
 class EmailInput(forms.TextInput):
 
 
 class EmailInput(forms.TextInput):
+       """Displays an HTML5 email input on browsers which support it and a normal text input on other browsers."""
        input_type = 'email'
 
 
 class RegistrationForm(UserCreationForm):
        input_type = 'email'
 
 
 class RegistrationForm(UserCreationForm):
+       """
+       Handles user registration. If :mod:`recaptcha_django` is installed on the system and :class:`recaptcha_django.middleware.ReCaptchaMiddleware` is in :setting:`settings.MIDDLEWARE_CLASSES`, then a recaptcha field will automatically be added to the registration form.
+       
+       .. seealso:: `recaptcha-django <http://code.google.com/p/recaptcha-django/>`_
+       
+       """
+       #: An :class:`EmailField` using the :class:`EmailInput` widget.
        email = forms.EmailField(widget=EmailInput)
        try:
                from recaptcha_django import ReCaptchaField
        email = forms.EmailField(widget=EmailInput)
        try:
                from recaptcha_django import ReCaptchaField
@@ -57,6 +65,7 @@ class RegistrationForm(UserCreationForm):
 
 
 class UserAccountForm(forms.ModelForm):
 
 
 class UserAccountForm(forms.ModelForm):
+       """Handles a user's account - by default, :attr:`auth.User.first_name`, :attr:`auth.User.last_name`, :attr:`auth.User.email`."""
        first_name = User._meta.get_field('first_name').formfield(required=True)
        last_name = User._meta.get_field('last_name').formfield(required=True)
        email = User._meta.get_field('email').formfield(required=True, widget=EmailInput)
        first_name = User._meta.get_field('first_name').formfield(required=True)
        last_name = User._meta.get_field('last_name').formfield(required=True)
        email = User._meta.get_field('email').formfield(required=True, widget=EmailInput)
@@ -71,6 +80,7 @@ class UserAccountForm(forms.ModelForm):
 
 
 class WaldoAuthenticationForm(AuthenticationForm):
 
 
 class WaldoAuthenticationForm(AuthenticationForm):
+       """Handles user authentication. Checks that the user has not mistakenly entered their email address (like :class:`django.contrib.admin.forms.AdminAuthenticationForm`) but does not require that the user be staff."""
        ERROR_MESSAGE = _("Please enter a correct username and password. Note that both fields are case-sensitive.")
        
        def clean(self):
        ERROR_MESSAGE = _("Please enter a correct username and password. Note that both fields are case-sensitive.")
        
        def clean(self):
@@ -94,11 +104,4 @@ class WaldoAuthenticationForm(AuthenticationForm):
                        elif not self.user_cache.is_active:
                                raise ValidationError(message)
                self.check_for_test_cookie()
                        elif not self.user_cache.is_active:
                                raise ValidationError(message)
                self.check_for_test_cookie()
-               return self.cleaned_data
-       
-       def check_for_test_cookie(self):
-               # This method duplicates the Django 1.3 AuthenticationForm method.
-               if self.request and not self.request.session.test_cookie_worked():
-                       raise forms.ValidationError(
-                               _("Your Web browser doesn't appear to have cookies enabled. "
-                                 "Cookies are required for logging in."))
\ No newline at end of file
+               return self.cleaned_data
\ No newline at end of file