beat.web.ui.registration.views module¶
Views which allow users to create and activate accounts.
-
beat.web.ui.registration.views.activate(request, activation_key, template_name='registration/activate.html', extra_context=None)[source]¶ Activate a
User’s account from an activation key, if their key is valid and hasn’t expired.By default, use the template
registration/activate.html; to change this, pass the name of a template as the keyword argumenttemplate_name.Required arguments
activation_keyThe activation key to validate and use for activating the
User.
Optional arguments
extra_contextA dictionary of variables to add to the template context. Any callable object in this dictionary will be called to produce the end result which appears in the context.
template_nameA custom template to use.
Context:
accountThe
Userobject corresponding to the account, if the activation was successful.Falseif the activation was not successful.expiration_daysThe number of days for which activation keys stay valid after registration.
Any extra variables supplied in the
extra_contextargument (see above).Template:
registration/activate.html or
template_namekeyword argument.
-
beat.web.ui.registration.views.register(request, success_url=None, form_class=<class 'beat.web.ui.registration.forms.RegistrationFormTermsOfService'>, template_name='registration/registration_form.html', extra_context=None)[source]¶ Allow a new user to register an account.
Following successful registration, issue a redirect; by default, this will be whatever URL corresponds to the named URL pattern
registration_complete, which will be/accounts/register/complete/if using the included URLConf. To change this, point that named pattern at another URL, or pass your preferred URL as the keyword argumentsuccess_url.By default,
registration.forms.RegistrationFormwill be used as the registration form; to change this, pass a different form class as theform_classkeyword argument. The form class you specify must have a methodsavewhich will create and return the newUser.By default, use the template
registration/registration_form.html; to change this, pass the name of a template as the keyword argumenttemplate_name.Required arguments
None.
Optional arguments
form_classThe form class to use for registration.
extra_contextA dictionary of variables to add to the template context. Any callable object in this dictionary will be called to produce the end result which appears in the context.
success_urlThe URL to redirect to on successful registration.
template_nameA custom template to use.
Context:
formThe registration form.
Any extra variables supplied in the
extra_contextargument (see above).Template:
registration/registration_form.html or
template_namekeyword argument.