Forms¶
Return to API Reference.
SignupForm¶
- class userena.forms.SignupForm(data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, field_order=None, use_required_attribute=None, renderer=None)¶
Form for creating a new user account.
Validates that the requested username and e-mail is not already in use. Also requires the password to be entered twice.
- clean()¶
Validates that the values entered into the two password fields match. Note that an error here will end up in
non_field_errors()
because it doesn’t apply to a single field.
- clean_email()¶
Validate that the e-mail address is unique.
- clean_username()¶
Validate that the username is alphanumeric and is not already in use. Also validates that the username is not listed in
USERENA_FORBIDDEN_USERNAMES
list.
- property media¶
Return all media required to render the widgets on this form.
- save()¶
Creates a new user and account. Returns the newly created user.
SignupFormOnlyEmail¶
- class userena.forms.SignupFormOnlyEmail(*args, **kwargs)¶
Form for creating a new user account but not needing a username.
This form is an adaptation of
SignupForm
. It’s used whenUSERENA_WITHOUT_USERNAME
setting is set toTrue
. And thus the user is not asked to supply an username, but one is generated for them. The user can than keep sign in by using their email.- property media¶
Return all media required to render the widgets on this form.
- save()¶
Generate a random username before falling back to parent signup form
SignupFormTos¶
- class userena.forms.SignupFormTos(data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, field_order=None, use_required_attribute=None, renderer=None)¶
Add a Terms of Service button to the
SignupForm
.- property media¶
Return all media required to render the widgets on this form.
AuthenticationForm¶
- class userena.forms.AuthenticationForm(*args, **kwargs)¶
A custom form where the identification can be a e-mail address or username.
- clean()¶
Checks for the identification and password.
If the combination can’t be found will raise an invalid sign in error.
- property media¶
Return all media required to render the widgets on this form.
ChangeEmailForm¶
- class userena.forms.ChangeEmailForm(user, *args, **kwargs)¶
- clean_email()¶
Validate that the email is not already registered with another user
- property media¶
Return all media required to render the widgets on this form.
- save()¶
Save method calls
user.change_email()
method which sends out an email with an verification key to verify and with it enable this new email address.
EditProfileForm¶
- class userena.forms.EditProfileForm(*args, **kw)¶
Base form used for fields that are always required
- property media¶
Return all media required to render the widgets on this form.
- save(force_insert=False, force_update=False, commit=True)¶
Save this form’s self.instance object if commit=True. Otherwise, add a save_m2m() method to the form which can be called after the instance is saved manually at a later time. Return the model instance.