File: simple-backend.rst

package info (click to toggle)
python-django-registration 1.0%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 704 kB
  • ctags: 306
  • sloc: python: 876; makefile: 84
file content (51 lines) | stat: -rw-r--r-- 1,981 bytes parent folder | download
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
.. _simple-backend:
.. module:: registration.backends.simple

The "simple" (one-step) backend
===============================

As an alternative to :ref:`the default backend <default-backend>`, and
an example of writing alternate workflows, django-registration bundles
a one-step registration system in
``registration.backend.simple``. This backend's workflow is
deliberately as simple as possible:

1. A user signs up by filling out a registration form.

2. The user's account is created and is active immediately, with no
   intermediate confirmation or activation step.

3. The new user is logged in immediately.


Configuration
-------------

To use this backend, simply include the URLconf
``registration.backends.simple.urls`` somewhere in your site's own URL
configuration. For example::

    (r'^accounts/', include('registration.backends.simple.urls')),

No additional settings are required, but one optional setting is
supported:

``REGISTRATION_OPEN``
    A boolean (either ``True`` or ``False``) indicating whether
    registration of new accounts is currently permitted. A default of
    ``True`` will be assumed if this setting is not supplied.

Upon successful registration, the default redirect is to the URL
specified by the ``get_absolute_url()`` method of the newly-created
``User`` object; by default, this will be ``/users/<username>/``,
although it can be overridden by implementing
:meth:`~registration.views.RegistrationView.get_success_url()` on a
subclass of ``registration.backends.simple.views.RegistrationView``.

The default form class used for account registration will be
:class:`registration.forms.RegistrationForm`, although this can be
overridden by supplying a custom URL pattern for the registration view
and passing the keyword argument ``form_class``, or by subclassing
``registration.backends.simple.views.RegistrationView`` and either
overriding ``form_class`` or implementing
:meth:`~registration.views.RegistrationView.get_form_class()`.