1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120
|
=====
Views
=====
Two views are included which, between them, handle the process of
first registering and then activating new user accounts; both views
are found in ``registration.views``.
``activate``
============
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 argument
``template_name``.
**Required arguments**
``activation_key``
The activation key to validate and use for activating the
``User``.
**Optional arguments**
``extra_context``
A 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_name``
A custom template to use.
**Context:**
``account``
The ``User`` object corresponding to the account, if the
activation was successful. ``False`` if the activation was not
successful.
``expiration_days``
The number of days for which activation keys stay valid after
registration.
Any extra variables supplied in the ``extra_context`` argument (see
above).
**Template:**
registration/activate.html or ``template_name`` keyword argument.
``register``
============
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 argument ``success_url``.
By default, ``registration.forms.RegistrationForm`` will be used as
the registration form; to change this, pass a different form class as
the ``form_class`` keyword argument. The form class you specify must
have a method ``save`` which will create and return the new ``User``,
and that method must accept the keyword argument ``profile_callback``
(see below).
To enable creation of a site-specific user profile object for the new
user, pass a function which will create the profile object as the
keyword argument ``profile_callback``. See
``RegistrationManager.create_inactive_user`` in the file ``models.py``
for details on how to write this function.
By default, use the template ``registration/registration_form.html``;
to change this, pass the name of a template as the keyword argument
``template_name``.
**Required arguments**
None.
**Optional arguments**
``form_class``
The form class to use for registration.
``extra_context``
A 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.
``profile_callback``
A function which will be used to create a site-specific profile
instance for the new ``User``.
``success_url``
The URL to redirect to on successful registration.
``template_name``
A custom template to use.
**Context:**
``form``
The registration form.
Any extra variables supplied in the ``extra_context`` argument (see
above).
**Template:**
registration/registration_form.html or ``template_name`` keyword
argument.
|