Source

django-registration / docs / views.txt

Full commit
=====
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``
=====================================

Activates a ``User``'s account, if their key is valid and hasn't
expired.

By default, uses 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**

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

**Template:**
    
registration/activate.html or ``template_name`` keyword argument.


``register``
============

Allows a new user to register an account.
    
Following successful registration, redirects to either
``/accounts/register/complete/`` or, if supplied, the URL specified in
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, uses 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.

``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.
    
**Template:**

registration/registration_form.html or ``template_name`` keyword
argument.