<commit_before>=====
Forms
=====


To ease and automate the process of validating user information during
registration, several form classes (built using Django's `newforms
library`_) are provided: a base ``RegistrationForm`` and subclasses
which provide specific customized functionality. All of the forms
described below are found in ``registration.forms``.

.. _newforms library: http://www.djangoproject.com/documentation/newforms/


``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, <PASSWORD>, 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``.
<commit_msg>Minor docs tweak since it's not "newforms" anymore.<commit_after>=====
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.

``<PASSWORD>``
    <PASSWORD>.

``<PASSWORD>``
    <PASSWORD>.


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

{'fraction_non_alphanumeric': 0.10346274921301155, 'fraction_numerical': 0.0004197271773347324, 'mean_word_length': 4.749095295536791, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 1, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5580845', 'n_tokens_mistral': 1198, 'n_tokens_neox': 1132, 'n_words': 545}