The one-step workflow#
As an alternative to the two-step (registration and activation) workflow, django-registration bundles a one-step registration
workflow in django_registration.backends.one_step
. This workflow consists of
as few steps as possible:
A user signs up by filling out a registration form.
The user’s account is created and is active immediately, with no intermediate confirmation or activation step.
The new user is logged in immediately.
Configuration#
To use this workflow, include the URLconf
django_registration.backends.one_step.urls
somewhere in your site’s own URL
configuration. For example:
from django.urls import include, path
urlpatterns = [
# Other URL patterns ...
path('accounts/', include('django_registration.backends.one_step.urls')),
path('accounts/', include('django.contrib.auth.urls')),
# More URL patterns ...
]
To control whether registration of new accounts is allowed, you can specify the
setting REGISTRATION_OPEN
.
Upon successful registration, the user will be redirected to the site’s home
page – the URL /
. This can be changed by subclassing
django_registration.backends.one_step.views.RegistrationView
and
overriding the method
get_success_url()
or setting
the attribute
success_url
. You can also
do this in a URLconf. For example:
from django.urls import include, path
from django_registration.backends.one_step.views import RegistrationView
urlpatterns = [
# Other URL patterns ...
path('accounts/register/',
RegistrationView.as_view(success_url='/profile/'),
name='django_registration_register'),
path('accounts/', include('django_registration.backends.one_step.urls')),
path('accounts/', include('django.contrib.auth.urls')),
# More URL patterns ...
]
The default form class used for account registration will be
django_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
django_registration.backends.one_step.views.RegistrationView
and
either overriding
form_class
or implementing
get_form_class()
, and
specifying the custom subclass in your URL patterns.
Templates#
The one-step workflow uses two templates:
django_registration/registration_form.html
.django_registration/registration_closed.html
See the quick start guide for details of these templates.