===== Forms ===== To ease and automate the process of validating user information during registration, several form classes (built using Django's `forms library`_) are provided: a base ``RegistrationForm`` and subclasses which provide specific customized functionality. All of the forms described below are found in ``registration.forms``. .. _forms library: http://docs.djangoproject.com/en/dev/topics/forms/ ``RegistrationForm`` ==================== Form for registering a new user account. Validates that the requested username is not already in use, and requires the password to be entered twice to catch typos. Subclasses should feel free to add any additional validation they need, but should either preserve the base ``save()`` or implement a ``save()`` method which returns a ``User``. Fields: ``username`` The new user's requested username. Will be validated according to the same regular expression Django's authentication system uses to validate usernames. ``email`` The new user's email address. Must be a well-formed email address. ``password1`` The new user's password. ``password2`` The password, again, to catch typos. Non-validation methods: ``save()`` Creates the new ``User`` and ``RegistrationProfile``, and returns the ``User`` (by calling ``RegistrationProfile.objects.create_inactive_user()``). Subclasses of ``RegistrationForm`` ================================== As explained above, subclasses may add any additional validation they like, but must either preserve the ``save()`` method or implement a ``save()`` method with an identical signature. Three subclasses are included as examples, and as ready-made implementations of useful customizations: ``RegistrationFormTermsOfService`` Subclass of ``RegistrationForm`` which adds a required checkbox for agreeing to a site's Terms of Service. ``RegistrationFormUniqueEmail`` Subclass of ``RegistrationForm`` which enforces uniqueness of email addresses. ``RegistrationFormNoFreeEmail`` Subclass of ``RegistrationForm`` which disallows registration with email addresses from popular free webmail services; moderately useful for preventing automated spam registrations. To change the list of banned domains, subclass this form and override the attribute ``bad_domains``.