Common forms for authentication tasks.
These forms can be used either directly or as a base for more specific forms. They’re designed to take some of the complexity out of creating authentication-related forms not otherwise provided by Django.
RegistrationForm(request=None, *args, **kwargs)¶
A standard registration form collecting basic account information.
This form prompts the user for a username, a password (and a confirmation on that password), e-mail address, first name, and last name. It then validates these, attempting to create a
This class can be extended by subclasses to provide additional fields.
__init__(request=None, *args, **kwargs)¶
x.__init__(…) initializes x; see help(type(x)) for signature
Validate that the two supplied passwords match.
If they do not match, validation will fail, and an error will be supplied to the user.
Returns: The password supplied on the form. Return type: str Raises:
ValidationError– If the passwords do not match.
Save the form, creating a user if validation passes.
Userwill be created with the provided username, e-mail address, password, and full name. If there are failures in creating this user, or there’s an existing user with the given name, an error will be raisd.
Subclasses that want to override this can call the parent’s py:meth:save and modify the resulting user, if
Noneis not returned.
Returns: The newly-created user. Return type: User