django-registration / docs / forms.txt


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:


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``.

    The new user's requested username. Will be validated according to
    the same regular expression Django's authentication system uses to
    validate usernames.

    The new user's email address. Must be a well-formed email address.

    The new user's password.

    The password, again, to catch typos.

Non-validation methods:

    Creates the new ``User`` and ``RegistrationProfile``, and returns
    the ``User`` (by calling

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:

    Subclass of ``RegistrationForm`` which adds a required checkbox
    for agreeing to a site's Terms of Service.

    Subclass of ``RegistrationForm`` which enforces uniqueness of
    email addresses.

    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``.
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.