Welcome to django-inspectional-registration’s documentation!¶







- Author
- Alisue <lambdalisue@hashnote.net>
- Supported python versions
- 2.6, 2.7, 3.2, 3.3, 3.4
- Supported django versions
- 1.3 - 1.7
django-inspectional-registration is a enhanced application of django-registration. The following features are available
- Inspection steps for registration. You can accept or reject the account registration before sending activation key to the user.
- Password will be filled in after the activation step to prevent that the user forget them previously filled password in registration step (No password filling in registration step)
- Password can be generated programatically and force to activate the user. The generated password will be sent to the user by e-mail.
- Any Django models are available to use as supplemental information of
registration if the models are subclasses of
registration.supplements.RegistrationSupplementBase
. It is commonly used for inspection. - You can send any additional messages to the user in each steps (acceptance, rejection and activation)
- The behaviors of the application are customizable with Backend feature.
- The E-mails or HTMLs are customizable with Django template system.
- Can be migrate from django-registration simply by south
- django-mailer compatible.
Emails sent from the application will use django-mailer if ‘mailer’ is
in your
INSTALLED_APPS
Documentations¶
Quick Tutorial¶
1. Install django-inspectional-registration¶
django-inspectional-registration is found on PyPI so execute the following command:
$ pip install django-inspectional-registration
or
$ easy_install django-inspectional-registration
And also the application is developped on github so you can install it from the repository as:
$ pip install git+https://github.com/lambdalisue/django-inspectional-registration.git#egg=django-inspectional-registration
2. Configure the application¶
To configure django-inspectional-registration, follow the instructions below
Add
'registration'
,'django.contrib.admin'
to yourINSTALLED_APPS
ofsettings.py
Note
If you already use django-registration, see Quick Migrations for migration.
Add
'registration.supplements.default'
to yourINSTALLED_APPS
ofsettings.py
or setREGISTRATION_SUPPLEMENT_CLASS
toNone
Note
django-inspectional-registration can handle registration supplemental information. If you want to use your own custom registration supplemental information, check About Registration Supplement for documents.
Settings
REGISTRATION_SUPPLEMENT_CLASS
toNone
mean no registration supplemental information will be used.Add
url('^registration/', include('registration.urls')),
to your very top of (same directory assettings.py
in default)urls.py
like below:from django.conf.urls.defaults import patterns, include, urls from django.contrib import admin admin.autodiscover() urlpatterns = pattern('', # some urls... # django-inspectional-registration require Django Admin page # to inspect registrations url('^admin/', include(admin.site.urls)), # Add django-inspectional-registration urls. The urls also define # Login, Logout and password_change or lot more for handle # registration. url('^registration/', include('registration.urls')), )
Call
syncdb
command to create the database tables like below:$ ./manage.py syncdb
Confirm that Django E-mail settings were properly configured. See https://docs.djangoproject.com/en/dev/topics/email/ for more detail.
Note
If you don’t want or too lazy to configure the settings. See django-mailer which store the email on database before sending.
To use django-mailer insted of django’s default email system in this application. Simply add ‘mailer’ to your
INSTALLED_APPS
then the application will use django-mailer insted.
How to use it¶
Access http://localhost:8000/registration/register then you will see the registration page. So fill up (use your own real email address) the fields and click
Register
button.Note
Did you start your development server? If not:
$ ./manage.py runserver 8000
Now go on the http://localhost:8000/admin/registration/registrationprofile/1/ and accept your registration by clicking
Save
button.Note
To reject or force to activate the registration, change
Action
and clickSave
Message
will be passed to each email template thus you can use the value ofMessage
as{{ message }}
in your email template. In default, theMessage
is only available in rejection email template to explain why the registration was rejected.You may get an Email from your website. The email contains an activation key so click the url.
Note
If you get
http://example.com/register/activate/XXXXXXXX
for your activation key, that mean you haven’t configure the site domain name in Django Admin. To prevent this, just set domain name of your site in Admin page.Two password form will be displayed on the activation page, fill up the password and click
Activate
to activate your account.
Quick Migrations¶
Instructions¶
django-inspectional-registration can be migrate from django-registration by south. To migrate, follow the instructions
Confirm your application has
'south'
,'django.contrib.admin'
and in yourINSTALLED_APPS
, if you haven’t, add these and runsyncdb
command to create the database table required.Execute following commands:
$ ./manage.py migrate registration 0001 --fake $ ./manage.py migrate registration
Rewrite your most top of
urls.py
as:from django.conf.urls.defaults import patterns, include, urls from django.contrib import admin admin.autodiscover() urlpatterns = pattern('', # some urls... # django-inspectional-registration require Django Admin page # to inspect registrations url('^admin/', include(admin.site.urls)), # Add django-inspectional-registration urls. The urls also define # Login, Logout and password_change or lot more for handle # registration. url('^registration/', include('registration.urls')), )
Set
REGISTRATION_SUPPLEMENT_CLASS
toNone
in yoursettings.py
Note
django-inspectional-registration can handle registration supplemental information. If you want to use your own custom registration supplemental information, check About Registration Supplement for documents.
Settings
REGISTRATION_SUPPLEMENT_CLASS
toNone
mean no registration supplemental information will be used.Done. Enjoy!
The database difference between django-registration and django-inspectional-registration¶
django-inspectional-registration add new CharField
named registration.models.RegistrationProfile._status
to
the registration.models.RegistrationProfile
and change the storategy to delete
RegistrationProfile
which has been activated from the database insted of
setting 'ALREADY_ACTIVATED'
to registration.models.RegistrationProfile.activation_key
.
activation_key
will be generated when the _status
of RegistrationProfile
be 'accepted'
otherwise it is set None
About Registration Supplement¶
Registration Supplement is a django model class which inherit
registration.supplements.RegistrationSupplementBase
.
It is used to add supplemental information to each registration.
Filling the supplemental information is required in registration step
and the filled supplemental information will be displayed in Django Admin
page.
To disable this supplement feature, set REGISTRATION_SUPPLEMENT_CLASS
to
None
in your settings.py
.
Quick tutorial to create your own Registration Supplement¶
Create new app named
supplementtut
with the command below:$ ./manage.py startapp supplementtut
Create new registration supplement model in your
models.py
as:from __future__ import unicode_literals from django.db import models from django.utils.encoding import python_2_unicode_compatible from registration.supplements.base import RegistrationSupplementBase class MyRegistrationSupplement(RegistrationSupplementBase): realname = models.CharField("Real name", max_length=100, help_text="Please fill your real name") age = models.IntegerField("Age") remarks = models.TextField("Remarks", blank=True) def __str__(self): # a summary of this supplement return "%s (%s)" % (self.realname, self.age)
Add
supplementtut
toINSTALLED_APPS
and setREGISTRATION_SUPPLEMENT_CLASS
to"supplementtut.models.MyRegistrationSupplement
in yoursettings.py
Done, execute
syncdb
andrunserver
to confirm your registration supplement is used correctly. See more documentation inregistration.supplements.RegistrationSupplementBase
About Registration Backend¶
Registration is handled by Registration Backend. See
registration.backends.RegistrationBackendBase
and
registration.backends.default.DefaultRegistrationBackend
for more
detail.
About Registration Templates¶
django-inspectional-registration use the following templates
Email templates¶
Used to create the email
acceptance Email¶
Sent when inspector accpet the account registration
registration/acceptance_email.txt
Used to create acceptance email. The following context will be passed
site
- An instance of
django.contrib.site.Site
to determine the site name and domain name user
- A user instance
profile
- An instance of
registration.models.RegistrationProfile
activation_key
An activation key used to generate activation url. To generate activation url, use the following template command:
http://{{ site.domain }}{% url 'registration_activate' activation_key=activation_key %}
expiration_days
- A number of days remaining during which the account may be activated.
message
- A message from inspector. Not used in default template.
registration/acceptance_email_subject.txt
Used to create acceptance email subject. The following context will be passed
site
- An instance of
django.contrib.site.Site
to determine the site name and domain name user
- A user instance
profile
- An instance of
registration.models.RegistrationProfile
activation_key
An activation key used to generate activation url. To generate activation url, use the following template command:
http://{{ site.domain }}{% url 'registration_activate' activation_key=activation_key %}
expiration_days
- A number of days remaining during which the account may be activated.
message
- A message from inspector. Not used in default template.
Note
All newline will be removed in this template because it is a subject.
Activation Email¶
Sent when the activation has complete.
registration/activation_email.txt
Used to create activation email. The following context will be passed
site
- An instance of
django.contrib.site.Site
to determine the site name and domain name user
- A user instance
password
- A password of the account. Use this for telling the password when the password is generated automatically.
is_generated
- If
True
, the password was generated programatically thus you have to tell the password to the user. message
- A message from inspector. Not used in default template.
registration/activation_email_subject.txt
Used to create activation email subject. The following context will be passed
site
- An instance of
django.contrib.site.Site
to determine the site name and domain name user
- A user instance
password
- A password of the account. Use this for telling the password when the password is generated automatically.
is_generated
- If
True
, the password was generated programatically thus you have to tell the password to the user. message
- A message from inspector. Not used in default template.
Note
All newline will be removed in this template because it is a subject.
Registration Email¶
Sent when the registration has complete.
registration/registration_email.txt
Used to create registration email. The following context will be passed
site
- An instance of
django.contrib.site.Site
to determine the site name and domain name user
- A user instance
profile
- An instance of
registration.models.RegistrationProfile
registration/registration_email_subject.txt
Used to create registration email subject. The following context will be passed
site
- An instance of
django.contrib.site.Site
to determine the site name and domain name user
- A user instance
profile
- An instance of
registration.models.RegistrationProfile
Note
All newline will be removed in this template because it is a subject.
Rejection Email¶
Sent when inspector reject the account registration
registration/rejection_email.txt
Used to create rejection email. The following context will be passed
site
- An instance of
django.contrib.site.Site
to determine the site name and domain name user
- A user instance
profile
- An instance of
registration.models.RegistrationProfile
message
- A message from inspector. Used for explain why the account registration was rejected in default template
registration/rejection_email_subject.txt
Used to create rejection email subject. The following context will be passed
site
- An instance of
django.contrib.site.Site
to determine the site name and domain name user
- A user instance
profile
- An instance of
registration.models.RegistrationProfile
message
- A message from inspector. Used for explain why the account registration was rejected in default template
Note
All newline will be removed in this template because it is a subject.
HTML Templates¶
The following template will be used
registration/activation_complete.html
- Used for activation complete page.
registration/activation_form
- Used for activation page.
form
context will be passed to generate the activation form. registration/login.html
- Used for login page.
form
context will be passed to generate the login form. registration/logout.html
- Used for logged out page.
registration/registration_closed.html
- Used for registration closed page.
registration/registration_complete.html
- Used for registration complete page.
registration_profile
context will be passed. registration/registration_form.html
Used for registration page.
form
context will be passed to generate registration form andsupplement_form
context will be passed to generate registration supplement form when the registration supplement exists. Use the following code in your template:<form action="" method="post">{% csrf_token %} {{ form.as_p }} {{ supplement_form.as_p }} <p><input type="submit" value="Register"></p> </form>
About Registration Signals¶
django-inspectional-registration provide the following signals.
user_registered(user, profile, request)
It is called when a user has registered. The arguments are:
user
- An instance of User model
profile
- An instance of RegistrationProfile model of the
user
request
- An instance of django’s HttpRequest. It is useful to automatically get extra user informations
user_accepted(user, profile, request)
It is called when a user has accepted by inspectors. The arguments are:
user
- An instance of User model
profile
- An instance of RegistrationProfile model of the
user
request
- An instance of django’s HttpRequest. It is useful to automatically get extra user informations
user_rejected(user, profile, request)
It is called when a user has rejected by inspectors. The arguments are:
user
- An instance of User model
profile
- An instance of RegistrationProfile model of the
user
request
- An instance of django’s HttpRequest. It is useful to automatically get extra user informations
user_activated(user, profile, is_generated, request)
It is called when a user has activated by 1) the user access the activation url, 2) inspectors forcely activate the user. The arguments are:
user
- An instance of User model
password
- If the user have forcely activated by inspectors, this indicate the
raw password, otherwise it is
None
(So that non automatically generated user password is protected from the suffering). is_generated
- When inspectors forcely activate the user, it become
True
. It mean that the user do not know own account password thus you need to tell the password to the user somehow (default activation e-mail automatically include the user password if thisis_generated
isTrue
) request
- An instance of django’s HttpRequest. It is useful to automatically get extra user informations
About Registration Settings¶
ACCOUNT_ACTIVATION_DAYS
The number of days to determine the remaining during which the account may be activated.
Default:
7
REGISTRATION_DEFAULT_PASSWORD_LENGTH
The integer length of the default password programatically generate.
Default:
10
REGISTRATION_BACKEND_CLASS
A string dotted python path for registration backend class.
Default:
'registration.backends.default.DefaultRegistrationBackend'
REGISTRATION_SUPPLEMENT_CLASS
A string dotted python path for registration supplement class.
Default:
'registration.supplements.default.DefaultRegistrationSupplement'
REGISTRATION_ADMIN_INLINE_BASE_CLASS
A string dotted python path for registration supplement admin inline base class.
Default:
'registration.admin.RegistrationSupplementAdminInlineBase'
REGISTRATION_OPEN
A boolean value whether the registration is currently allowed.
Default:
True
REGISTRATION_REGISTRATION_EMAIL
Set
False
to disable sending registration email to the user.Default:
True
REGISTRATION_ACCEPTANCE_EMAIL
Set
False
to disable sending acceptance email to the user.Default:
True
REGISTRATION_REJECTION_EMAIL
Set
False
to disable sending rejection email to the user.Default:
True
REGISTRATION_ACTIVATION_EMAIL
Set
False
to disable sending activation email to the user.Default:
True
REGISTRATION_DJANGO_AUTH_URLS_ENABLE
(from Version 0.4.0)If it is
False
, django-inspectional-registration do not define the views of django.contrib.auth. It is required to define these view manually.Default:
True
REGISTRATION_DJANGO_AUTH_URL_NAMES_PREFIX
(from Version 0.4.0)It is used as a prefix string of view names of django.contrib.auth. For backward compatibility, set this value to
'auth_'
.Default:
''
REGISTRATION_DJANGO_AUTH_URL_NAMES_SUFFIX
(from Version 0.4.0)It is used as a suffix string of view names of django.contrib.auth. For backward compatibility, set this value to
''
.Default:
''
About Registration Contributions¶
How to use contribution¶
Registration contributions are simple django app thus you just need to add the
path of the contribution to INSTALLED_APPS
. See the documentation of each
contribution for more detail.
autologin |
|
notification |
FAQ¶
Help! Email have not been sent to the user!¶
To enable sending email in django, you must have the following settings in your
settings.py
:
# if your smtp host use TLS
#EMAIL_USE_TLS = True
# url of your smtp host
EMAIL_HOST = ''
# if your smtp host requre username
#EMAIL_HOST_USER = ''
# if your smtp host require password
#EMAIL_HOST_PASSWORD = ''
# port number which your smtp host used (default 25)
# EMAIL_PORT = 587
DEFAULT_FROM_EMAIL = 'webmaster@your.domain'
If you don’t have SMTP host but you have Gmail, use the following settings to use your Gmail for SMTP host:
EMAIL_USE_TLS = True
EMAIL_PORT = 587
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_HOST_USER = 'your_email_address@gmail.com'
EMAIL_HOST_PASSWORD = 'your gmail password'
DEFAULT_FROM_EMAIL = 'your_email_address@gmail.com'
How can I get notification email when new user has registered in the site?¶
Use registration.contrib.notification
.
Add 'registration.contrib.notification'
to your INSTALLED_APPS
and create
following template files in your template directory.
registration/notification_email.txt
registration/notification_email_subject.txt
I want to use django-inspectional-registration but I don’t need inspection step¶
If you don’t need inspection step, use original django-registration in that case.
However, sometime you do may want to use django-inspectional-registration but inspection. Then follow the instructions below
Disable sending registration email with setting
REGISTRATION_REGISTRATION_EMAIL
toFalse
Add special signal reciever which automatically accept the user registration:
from registration.backends import get_backend from registration.signals import user_registered def automatically_accept_registration_reciver(sender, user, profile, request, **kwargs): backend = get_backend() backend.accept(profile, request=request) user_registered.connect(automatically_accept_registration_reciver)
Then the application behaviors like django-registration
How can I contribute to django-inspectional-registration¶
Any contributions include adding translations are welcome!
Use github’s pull request
for contribution.
src¶
registration package¶
Subpackages¶
registration.admin package¶
-
class
registration.admin.forms.
RegistrationAdminForm
(*args, **kwargs)[source]¶ Bases:
django.forms.models.ModelForm
A special form for handling
RegistrationProfile
This form handle
RegistrationProfile
correctly insave()
method. BecauseRegistrationProfile
is not assumed to handle by hands, instance modification by hands is not allowed. Thus subclasses should feel free to add any additions they need, but should avoid overriding asave()
method.-
ACCEPTED_ACTIONS
= ((u'accept', <django.utils.functional.__proxy__ object at 0x7f2a9a1406d0>), (u'activate', <django.utils.functional.__proxy__ object at 0x7f2a9a140710>))¶
-
RegistrationAdminForm.
REJECTED_ACTIONS
= ((u'accept', <django.utils.functional.__proxy__ object at 0x7f2a9a140750>), (u'force_activate', <django.utils.functional.__proxy__ object at 0x7f2a9a140790>))¶
-
RegistrationAdminForm.
UNTREATED_ACTIONS
= ((u'accept', <django.utils.functional.__proxy__ object at 0x7f2a9a1358d0>), (u'reject', <django.utils.functional.__proxy__ object at 0x7f2a9a140690>), (u'force_activate', <django.utils.functional.__proxy__ object at 0x7f2a9a135650>))¶
-
RegistrationAdminForm.
base_fields
= OrderedDict([('action_name', <django.forms.fields.ChoiceField object at 0x7f2a9a140810>), ('message', <django.forms.fields.CharField object at 0x7f2a9a140910>)])¶
-
RegistrationAdminForm.
clean_action
()[source]¶ clean action value
Insted of raising AttributeError, validate the current registration profile status and the requested action and then raise ValidationError
-
RegistrationAdminForm.
declared_fields
= OrderedDict([('action_name', <django.forms.fields.ChoiceField object at 0x7f2a9a140810>), ('message', <django.forms.fields.CharField object at 0x7f2a9a140910>)])¶
-
RegistrationAdminForm.
media
¶
-
RegistrationAdminForm.
registration_backend
= <registration.backends.default.DefaultRegistrationBackend object>¶
-
RegistrationAdminForm.
save
(commit=True)[source]¶ Call appropriate action via current registration backend
Insted of modifing the registration profile, this method call current registration backend’s accept/reject/activate method as requested.
-
RegistrationAdminForm.
save_m2m
(x)¶
-
-
class
registration.admin.
RegistrationSupplementAdminInlineBase
(parent_model, admin_site)[source]¶ Bases:
django.contrib.admin.options.StackedInline
Registration supplement admin inline base class
This inline class is used to generate admin inline class of current registration supplement. Used inline class is defined as
settings.REGISTRATION_SUPPLEMENT_ADMIN_INLINE_BASE_CLASS
thus if you want to modify the inline class of supplement, create a subclass of this class and set toREGISTRATION_SUPPLEMENT_ADMIN_INLINE_BASE_CLASS
-
fields
= ()¶
-
get_readonly_fields
(request, obj=None)[source]¶ get readonly fields of supplement
Readonly fields will be generated by supplement’s
get_admin_fields
andget_admin_excludes
method thus if you want to change the fields displayed in django admin site. You want to change the method or attributesadmin_fields
oradmin_excludes
which is loaded by those method in default.See more detail in
registration.supplements.DefaultRegistrationSupplement
documentation.
-
media
¶
-
-
class
registration.admin.
RegistrationAdmin
(model, admin_site)[source]¶ Bases:
django.contrib.admin.options.ModelAdmin
Admin class of RegistrationProfile
Admin users can accept/reject registration and activate user in Django Admin page.
If
REGISTRATION_SUPPLEMENT_CLASS
is specified, admin users can see the summary of the supplemental information in list view and detail of it in change view.RegistrationProfile
is not assumed to handle by hand thus adding/changing/deleting is not accepted even in Admin page.RegistrationProfile
only can be accepted/rejected or activated. To prevent these disallowed functions, the special AdminForm calledRegistrationAdminForm
is used. Itssave
method is overridden and it actually does not save the instance. It just callaccept
,reject
oractivate
method of current registration backend. So you don’t want to override thesave
method of the form.-
accept_users
(request, queryset)[source]¶ Accept the selected users, if they are not already accepted
-
actions
= (u'accept_users', u'reject_users', u'force_activate_users', u'resend_acceptance_email')¶
-
backend
= <registration.backends.default.DefaultRegistrationBackend object>¶
-
change_view
(*args, **kwargs)[source]¶ called for change view
Check permissions of the admin user for
POST
request depends on what action is requested and raise PermissionDenied if the action is not accepted for the admin user.
-
display_activation_key
(obj)[source]¶ Display activation key with link
Note that displaying activation key is not recommended in security reason. If you really want to use this method, create your own subclass and re-register to admin.site
Even this is a little bit risky, it is really useful for developping (without checking email, you can activate any user you want) thus I created but turned off in default :-p
-
display_supplement_summary
(obj)[source]¶ Display supplement summary
Display
__unicode__
method result ofREGISTRATION_SUPPLEMENT_CLASS
Not available
whenREGISTRATION_SUPPLEMENT_CLASS
is not specified
-
force_activate_users
(request, queryset)[source]¶ Activates the selected users, if they are not already activated
-
form
¶ alias of
RegistrationAdminForm
-
get_actions
(request)[source]¶ get actions displaied in admin site
RegistrationProfile should not be deleted in admin site thus ‘delete_selected’ is disabled in default.
Each actions has permissions thus delete the action if the accessed user doesn’t have appropriate permission.
-
get_inline_instances
(request, obj=None)[source]¶ return inline instances with registration supplement inline instance
-
get_object
(request, object_id, from_field=None)[source]¶ add
request
instance to model instance and returnTo get
request
instance in form,request
instance is stored in the model instance.
-
has_delete_permission
(request, obj=None)[source]¶ registration profile should not be created by hand
-
list_display
= (u'user', u'get_status_display', u'activation_key_expired', u'display_supplement_summary')¶
-
list_filter
= (u'_status',)¶
-
media
¶
-
raw_id_fields
= [u'user']¶
-
readonly_fields
= (u'user', u'_status')¶
-
reject_users
(request, queryset)[source]¶ Reject the selected users, if they are not already accepted
-
resend_acceptance_email
(request, queryset)[source]¶ Re-sends acceptance emails for the selected users
Note that this will only send acceptance emails for users who are eligible to activate; emails will not be sent to users whose activation keys have expired or who have already activated or rejected.
-
search_fields
= (u'user__username', u'user__first_name', u'user__last_name')¶
-
registration.backends package¶
-
class
registration.backends.default.
DefaultRegistrationBackend
[source]¶ Bases:
registration.backends.base.RegistrationBackendBase
Default registration backend class
A registration backend which floows a simple workflow:
- User sigs up, inactive account with unusable password is created.
- Inspector accept or reject the account registration.
- Email is sent to user with/without activation link (without when rejected)
- User clicks activation link, enter password, account is now active
Using this backend requires that
registration
be listed in theINSTALLED_APPS
settings (since this backend makes use of models defined in this application).django.contrib.admin
be listed in theINSTALLED_APPS
settings- The setting
ACCOUNT_ACTIVATION_DAYS
be supplied, specifying (as an integer) the number of days from acceptance during which a user may activate their account (after that period expires, activation will be disallowed). Default is7
- The creation of the templates
registration/registration_email.txt
registration/registration_email_subject.txt
registration/acceptance_email.txt
registration/acceptance_email_subject.txt
registration/rejection_email.txt
registration/rejection_email_subject.txt
registration/activation_email.txt
registration/activation_email_subject.txt
Additinally, registration can be temporarily closed by adding the setting
REGISTRATION_OPEN
and setting it toFalse
. Omitting this setting, or setting it toTrue
, will be imterpreted as meaning that registration is currently open and permitted.Internally, this is accomplished via storing an activation key in an instance of
registration.models.RegistrationProfile
. See that model and its custom manager for full documentation of its fields and supported operations.-
accept
(profile, request, send_email=None, message=None, force=False)[source]¶ accept the account registration of
profile
Given a profile, accept account registration, which will set inspection status of
profile
toaccepted
and generate new activation key ofprofile
.An email will be sent to the supplied email address; The email will be rendered using two templates. See the documentation for
RegistrationProfile.send_acceptance_email()
for information about these templates and the contexts provided to them.If
REGISTRATION_acceptance_EMAIL
of settings isNone
, no acceptance email will be sent.After successful acceptance, the signal
registration.signals.user_accepted
will be sent, with the newly acceptedUser
as the keyword argumentuesr
, theRegistrationProfile
of theUser
as the keyword argumentprofile
and the class of this backend as the sender
-
activate
(activation_key, request, password=None, send_email=None, message=None, no_profile_delete=False)[source]¶ activate user with
activation_key
andpassword
Given an activation key, password, look up and activate the user account corresponding to that key (if possible) and set its password.
If
password
is not given, password will be generatedAn email will be sent to the supplied email address; The email will be rendered using two templates. See the documentation for
RegistrationProfile.send_activation_email()
for information about these templates and the contexts provided to them.If
REGISTRATION_ACTIVATION_EMAIL
of settings isNone
, no activation email will be sent.After successful activation, the signal
registration.signals.user_activated
will be sent, with the newly activatedUser
as the keyword argumentuesr
, the password of theUser
as the keyword argumentpassword
, whether the password has generated or not as the keyword argumentis_generated
and the class of this backend as the sender
-
get_activation_complete_url
(user)[source]¶ Return a url to redirect to after successful user activation
-
get_registration_complete_url
(user)[source]¶ Return a url to redirect to after successful user registration
-
get_supplement_form_class
()[source]¶ Return the default form class used for user registration supplement
-
register
(username, email, request, supplement=None, send_email=None)[source]¶ register new user with
username
andemail
Given a username, email address, register a new user account, which will initially be inactive and has unusable password.
Along with the new
User
object, a newregistration.models.RegistrationProfile
will be created, tied to thatUser
, containing the inspection status and activation key which will be used for this account (activation key is not generated untill its inspection status is set toaccepted
)An email will be sent to the supplied email address; The email will be rendered using two templates. See the documentation for
RegistrationProfile.send_registration_email()
for information about these templates and the contexts provided to them.If
REGISTRATION_REGISTRATION_EMAIL
of settings isNone
, no registration email will be sent.After the
User
andRegistrationProfile
are created and the registration email is sent, the signalregistration.signals.user_registered
will be sent, with the newUser
as the keyword argumentuser
, theRegistrationProfile
of the newUser
as the keyword argumentprofile
and the class of this backend as the sender.
-
registration_allowed
()[source]¶ Indicate whether account registration is currently permitted, based on the value of the setting
REGISTRATION_OEPN
. This is determined as follows:- If
REGISTRATION_OPEN
is not specified in settings, or is set toTrue
, registration is permitted. - If
REGISTRATION_OPEN
is both specified and set toFalse
, registration is not permitted.
- If
-
reject
(profile, request, send_email=None, message=None)[source]¶ reject the account registration of
profile
Given a profile, reject account registration, which will set inspection status of
profile
torejected
and delete activation key ofprofile
if exists.An email will be sent to the supplied email address; The email will be rendered using two templates. See the documentation for
RegistrationProfile.send_rejection_email()
for information about these templates and the contexts provided to them.If
REGISTRATION_REJECTION_EMAIL
of settings isNone
, no rejection email will be sent.After successful rejection, the signal
registration.signals.user_rejected
will be sent, with the newly rejectedUser
as the keyword argumentuesr
, theRegistrationProfile
of theUser
as the keyword argumentprofile
and the class of this backend as the sender
-
class
registration.backends.base.
RegistrationBackendBase
[source]¶ Bases:
object
Base class of registration backend
-
get_site -- return current site
-
register -- register a new user
-
accept -- accept a registration
-
reject -- reject a registration
-
activate -- activate a user
-
get_supplement_class -- get registration supplement class
-
get_activation_form_class -- get activation form class
-
get_registration_form_class -- get registration form class
-
get_supplement_form_class -- get registration supplement form class
-
get_activation_complete_url -- get activation complete redirect url
-
get_registration_complete_url -- get registration complete redirect url
-
get_registration_closed_url -- get registration closed redirect url
-
registration_allowed -- whether registration is allowed now
-
accept
(profile, request, send_email=True, message=None, force=False)[source]¶ accept account registration with given
profile
(an instance ofRegistrationProfile
)Returning should be a instance of accepted
User
for success,None
for fail.This method SHOULD work even after the account registration has rejected.
-
activate
(activation_key, request, password=None, send_email=True, message=None, no_profile_delete=False)[source]¶ activate account with
activation_key
andpassword
This method should be called after the account registration has accepted, otherwise it should not be success.
Returning is
user
,password
andis_generated
for success,None
for fail.If
password
is not given, this method will generate password andis_generated
should beTrue
in this case.
-
get_site
(request)[source]¶ get current
django.contrib.Site
instancereturn
django.contrib.RequestSite
instance when theSite
is not installed.
-
-
registration.backends.
get_backend
(path=None)[source]¶ Return an instance of a registration backend, given the dotted Python import path (as a string) to the backend class.
If the backend cannot be located (e.g., because no such module exists, or because the module does not contain a class of the appropriate name),
django.core.exceptions.ImproperlyConfigured
is raised.
-
class
registration.backends.
RegistrationBackendBase
[source]¶ Bases:
object
Base class of registration backend
-
get_site -- return current site
-
register -- register a new user
-
accept -- accept a registration
-
reject -- reject a registration
-
activate -- activate a user
-
get_supplement_class -- get registration supplement class
-
get_activation_form_class -- get activation form class
-
get_registration_form_class -- get registration form class
-
get_supplement_form_class -- get registration supplement form class
-
get_activation_complete_url -- get activation complete redirect url
-
get_registration_complete_url -- get registration complete redirect url
-
get_registration_closed_url -- get registration closed redirect url
-
registration_allowed -- whether registration is allowed now
-
accept
(profile, request, send_email=True, message=None, force=False)[source]¶ accept account registration with given
profile
(an instance ofRegistrationProfile
)Returning should be a instance of accepted
User
for success,None
for fail.This method SHOULD work even after the account registration has rejected.
-
activate
(activation_key, request, password=None, send_email=True, message=None, no_profile_delete=False)[source]¶ activate account with
activation_key
andpassword
This method should be called after the account registration has accepted, otherwise it should not be success.
Returning is
user
,password
andis_generated
for success,None
for fail.If
password
is not given, this method will generate password andis_generated
should beTrue
in this case.
-
get_site
(request)[source]¶ get current
django.contrib.Site
instancereturn
django.contrib.RequestSite
instance when theSite
is not installed.
-
registration.contrib package¶
-
class
registration.contrib.autologin.tests.
RegistrationAutoLoginTestCase
(methodName='runTest')[source]¶ Bases:
django.test.testcases.TestCase
-
backend
= <registration.backends.default.DefaultRegistrationBackend object>¶
-
mock_request
= <WSGIRequest: GET '/'>¶
-
-
class
registration.contrib.notification.conf.
InspectionalRegistrationNotificationAppConf
(**kwargs)[source]¶ Bases:
appconf.base.AppConf
-
InspectionalRegistrationNotificationAppConf.
NOTIFICATION
= True¶
-
InspectionalRegistrationNotificationAppConf.
NOTIFICATION_ADMINS
= True¶
-
InspectionalRegistrationNotificationAppConf.
NOTIFICATION_EMAIL_SUBJECT_TEMPLATE_NAME
= u'registration/notification_email_subject.txt'¶
-
InspectionalRegistrationNotificationAppConf.
NOTIFICATION_EMAIL_TEMPLATE_NAME
= u'registration/notification_email.txt'¶
-
InspectionalRegistrationNotificationAppConf.
NOTIFICATION_MANAGERS
= True¶
-
InspectionalRegistrationNotificationAppConf.
NOTIFICATION_RECIPIENTS
= None¶
-
registration.management package¶
registration.migrations package¶
-
class
registration.migrations.0001_initial.
Migration
(name, app_label)[source]¶ Bases:
django.db.migrations.migration.Migration
-
dependencies
= [(u'auth', u'__first__')]¶
-
operations
= [<CreateModel fields=[(u'id', <django.db.models.fields.AutoField>), (u'_status', <django.db.models.fields.CharField>), (u'activation_key', <django.db.models.fields.CharField>), (u'user', <django.db.models.fields.related.OneToOneField>)], bases=(<class 'django.db.models.base.Model'>,), options={u'verbose_name': u'registration profile', u'verbose_name_plural': u'registration profiles', u'permissions': ((u'accept_registration', u'Can accept registration'), (u'reject_registration', u'Can reject registration'), (u'activate_user', u'Can activate user in admin site'))}, name=u'RegistrationProfile'>]¶
-
registration.south_migrations package¶
registration.supplements package¶
-
class
registration.supplements.default.models.
DefaultRegistrationSupplement
(*args, **kwargs)[source]¶ Bases:
registration.supplements.base.RegistrationSupplementBase
A simple registration supplement model which requires remarks
-
exception
DoesNotExist
¶ Bases:
django.core.exceptions.ObjectDoesNotExist
-
exception
DefaultRegistrationSupplement.
MultipleObjectsReturned
¶ Bases:
django.core.exceptions.MultipleObjectsReturned
-
DefaultRegistrationSupplement.
id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
DefaultRegistrationSupplement.
objects
= <django.db.models.manager.Manager object>¶
-
DefaultRegistrationSupplement.
registration_profile
¶ Accessor to the related object on the forward side of a many-to-one or one-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
child.parent
is aForwardManyToOneDescriptor
instance.
-
DefaultRegistrationSupplement.
remarks
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
exception
-
class
registration.supplements.base.
RegistrationSupplementBase
(*args, **kwargs)[source]¶ Bases:
django.db.models.base.Model
A registration supplement abstract model
Registration supplement model is used to add supplemental information to the account registration. The supplemental information is written by the user who tried to register the site and displaied in django admin page to help determine the acceptance/rejection of the registration
The
__str__()
method is used to display the summary of the supplemental information in django admin’s change list view. Thus subclasses must define them own__str__()
method.The
get_form_class()
is a class method return a value ofform_class
attribute to determine the form class used for filling up the supplemental informatin in registration view ifform_class
is specified. Otherwise the method create django’sModelForm
and return.The
get_admin_fields()
is a class method return a list of field names displayed in django admin site. It simply return a value ofadmin_fields
attribute in default. If the method returnNone
, then all fields exceptid
(and fields inadmin_excludes
) will be displayed.The
get_admin_excludes()
is a class method return a list of field names NOT displayed in django admin site. It simply return a value ofadmin_excludes
attribute in default. If the method returnNone
, then all fields selected withadmin_fields
exceptid
will be displayed.The
registration_profile
field is used to determine the registration profile associated with.related_name
of the field is used to get the supplemental information in_get_supplement()
method ofRegistrationProfile
thus DO NOT CHANGE the name.-
RegistrationSupplementBase.
admin_excludes
= None¶
-
RegistrationSupplementBase.
admin_fields
= None¶
-
RegistrationSupplementBase.
form_class
= None¶
-
classmethod
RegistrationSupplementBase.
get_admin_excludes
()[source]¶ Return a list of field names NOT displayed in django admin site
It is simply return a value of
admin_excludes
in default. If it returnsNone
then all fields (selected inadmin_fields
) exceptid
will be displayed.
-
classmethod
RegistrationSupplementBase.
get_admin_fields
()[source]¶ Return a list of field names displayed in django admin site
It is simply return a value of
admin_fields
in default. If it returnsNone
then all fields exceptid
(and fields inadmin_excludes
) will be displayed.
-
classmethod
RegistrationSupplementBase.
get_form_class
()[source]¶ Return the form class used for this registration supplement model
When
form_class
is specified, this method return the value of the attribute. Otherwise it generate django’sModelForm
, set it toform_class
and return itThis method MUST BE class method.
-
RegistrationSupplementBase.
registration_profile
¶ Accessor to the related object on the forward side of a many-to-one or one-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
child.parent
is aForwardManyToOneDescriptor
instance.
-
RegistrationSupplementBase.
registration_profile_id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
-
registration.supplements.
get_supplement_class
(path=None)[source]¶ Return an instance of a registration supplement, given the dotted Python import path (as a string) to the supplement class.
If the addition cannot be located (e.g., because no such module exists, or because the module does not contain a class of the appropriate name),
django.core.exceptions.ImproperlyConfigured
is raised.
registration.tests package¶
-
class
registration.tests.test_forms.
ActivationFormTests
(methodName='runTest')[source]¶ Bases:
django.test.testcases.TestCase
Test the default registration forms.
-
class
registration.tests.test_forms.
RegistrationFormTests
(methodName='runTest')[source]¶ Bases:
django.test.testcases.TestCase
Test the default registration forms.
-
test_registration_form
()[source]¶ Test that
RegistrationForm
enforces username constraints and matching passwords.
-
test_registration_form_no_free_email
()[source]¶ Test that
RegistrationFormNoFreeEmail
disallows registration with free email addresses.
-
-
class
registration.tests.test_models.
RegistrationProfileManagerTestCase
(methodName='runTest')[source]¶ Bases:
django.test.testcases.TestCase
-
user_info
= {u'username': u'alice', u'email': u'alice@example.com'}¶
-
-
class
registration.tests.test_supplements.
RegistrationSupplementRetrievalTests
(methodName='runTest')[source]¶ Bases:
django.test.testcases.TestCase
-
class
registration.tests.test_supplements.
RegistrationViewWithDefaultRegistrationSupplementTestCase
(methodName='runTest')[source]¶ Bases:
django.test.testcases.TestCase
-
test_registration_view_get
()[source]¶ A
GET
to theregister
view uses the appropriate template and populates the registration form into the context.
-
test_registration_view_post_failure
()[source]¶ A
POST
to theregister
view with invalid data does not create a user, and displays appropriate error messages.
-
-
class
registration.tests.test_views.
RegistrationViewTestCase
(methodName='runTest')[source]¶ Bases:
django.test.testcases.TestCase
-
test_activation_view_get_fail
()[source]¶ A
GET
to theActivationView
view wht invalid activation_key raise Http404
-
test_activation_view_get_success
()[source]¶ A
GET
to theActivationView
view with valid activation_key
-
test_activation_view_post_failure
()[source]¶ A
POST
to theActivationView
view with invalid data does not activate a user, and raise Http404
-
test_activation_view_post_success
()[source]¶ A
POST
to theActivationView
view with valid data properly handles a valid activation
-
test_registration_complete_view_get
()[source]¶ A
GET
to thecomplete
view uses the appropriate template and populates the registration form into the context.
-
test_registration_view_closed
()[source]¶ Any attempt to access the
register
view when registration is closed fails and redirects.
-
test_registration_view_get
()[source]¶ A
GET
to theregister
view uses the appropriate template and populates the registration form into the context.
-
Submodules¶
registration.conf module¶
-
class
registration.conf.
InspectionalRegistrationAppConf
(**kwargs)[source]¶ Bases:
appconf.base.AppConf
-
ACCEPTANCE_EMAIL
= True¶
-
ACTIVATION_EMAIL
= True¶
-
BACKEND_CLASS
= u'registration.backends.default.DefaultRegistrationBackend'¶
-
DEFAULT_PASSWORD_LENGTH
= 10¶
-
DJANGO_AUTH_URLS_ENABLE
= True¶
-
DJANGO_AUTH_URL_NAMES_PREFIX
= u''¶
-
DJANGO_AUTH_URL_NAMES_SUFFIX
= u''¶
-
InspectionalRegistrationAppConf.
OPEN
= True¶
-
InspectionalRegistrationAppConf.
REJECTION_EMAIL
= True¶
-
InspectionalRegistrationAppConf.
SUPPLEMENT_ADMIN_INLINE_BASE_CLASS
= u'registration.admin.RegistrationSupplementAdminInlineBase'¶
-
InspectionalRegistrationAppConf.
SUPPLEMENT_CLASS
= u'registration.supplements.default.models.DefaultRegistrationSupplement'¶
-
InspectionalRegistrationAppConf.
USE_OBJECT_PERMISSION
= False¶
-
registration.forms module¶
-
class
registration.forms.
ActivationForm
(data=None, files=None, auto_id=u'id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, field_order=None, use_required_attribute=None)[source]¶ Bases:
django.forms.forms.Form
Form for activating a user account.
Requires the password to be entered twice to catch typos.
Subclasses should feel free to add any additional validation they need, but should avoid defining a
save()
method – the actual saving of collected user data is delegated to the active registration backend.-
base_fields
= OrderedDict([('password1', <django.forms.fields.CharField object at 0x7f2a9a135b10>), ('password2', <django.forms.fields.CharField object at 0x7f2a9a135cd0>)])¶
-
clean
()[source]¶ Check the passed two password are equal
Verifiy that the values entered into the two password fields match. Note that an error here will end up in
non_field_errors()
because it doesn’t apply to a single field.
-
declared_fields
= OrderedDict([('password1', <django.forms.fields.CharField object at 0x7f2a9a135b10>), ('password2', <django.forms.fields.CharField object at 0x7f2a9a135cd0>)])¶
-
media
¶
-
-
class
registration.forms.
RegistrationForm
(data=None, files=None, auto_id=u'id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, field_order=None, use_required_attribute=None)[source]¶ Bases:
django.forms.forms.Form
Form for registration a user account.
Validates that the requested username is not already in use, and requires the email to be entered twice to catch typos.
Subclasses should feel free to add any additional validation they need, but should avoid defining a
save()
method – the actual saving of collected user data is delegated to the active registration backend.-
base_fields
= OrderedDict([('username', <django.forms.fields.RegexField object at 0x7f2a9a135f10>), ('email1', <django.forms.fields.EmailField object at 0x7f2a9a1400d0>), ('email2', <django.forms.fields.EmailField object at 0x7f2a9a140210>)])¶
-
clean
()[source]¶ Check the passed two email are equal
Verifiy that the values entered into the two email fields match. Note that an error here will end up in
non_field_errors()
because it doesn’t apply to a single field.
-
declared_fields
= OrderedDict([('username', <django.forms.fields.RegexField object at 0x7f2a9a135f10>), ('email1', <django.forms.fields.EmailField object at 0x7f2a9a1400d0>), ('email2', <django.forms.fields.EmailField object at 0x7f2a9a140210>)])¶
-
media
¶
-
-
class
registration.forms.
RegistrationFormNoFreeEmail
(data=None, files=None, auto_id=u'id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, field_order=None, use_required_attribute=None)[source]¶ Bases:
registration.forms.RegistrationForm
Subclass of
RegistrationForm
which disallows registration with email addresses from popular free webmail services; moderately useful for preventing automated spam registration.To change the list of banned domains, subclass this form and override the attribute
bad_domains
.-
bad_domains
= [u'aim.com', u'aol.com', u'email.com', u'gmail.com', u'googlemail.com', u'hotmail.com', u'hushmail.com', u'msn.com', u'mail.ru', u'mailinator.com', u'live.com', u'yahoo.com']¶
-
base_fields
= OrderedDict([('username', <django.forms.fields.RegexField object at 0x7f2a9a135f10>), ('email1', <django.forms.fields.EmailField object at 0x7f2a9a1400d0>), ('email2', <django.forms.fields.EmailField object at 0x7f2a9a140210>)])¶
-
clean_email1
()[source]¶ Check the supplied email address against a list of known free webmail domains.
-
declared_fields
= OrderedDict([('username', <django.forms.fields.RegexField object at 0x7f2a9a135f10>), ('email1', <django.forms.fields.EmailField object at 0x7f2a9a1400d0>), ('email2', <django.forms.fields.EmailField object at 0x7f2a9a140210>)])¶
-
media
¶
-
-
class
registration.forms.
RegistrationFormTermsOfService
(data=None, files=None, auto_id=u'id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, field_order=None, use_required_attribute=None)[source]¶ Bases:
registration.forms.RegistrationForm
Subclass of
RegistrationForm
which adds a required checkbox for agreeing to a site’s Terms of Service.-
base_fields
= OrderedDict([('username', <django.forms.fields.RegexField object at 0x7f2a9a135f10>), ('email1', <django.forms.fields.EmailField object at 0x7f2a9a1400d0>), ('email2', <django.forms.fields.EmailField object at 0x7f2a9a140210>), ('tos', <django.forms.fields.BooleanField object at 0x7f2a9a140450>)])¶
-
declared_fields
= OrderedDict([('username', <django.forms.fields.RegexField object at 0x7f2a9a135f10>), ('email1', <django.forms.fields.EmailField object at 0x7f2a9a1400d0>), ('email2', <django.forms.fields.EmailField object at 0x7f2a9a140210>), ('tos', <django.forms.fields.BooleanField object at 0x7f2a9a140450>)])¶
-
media
¶
-
-
class
registration.forms.
RegistrationFormUniqueEmail
(data=None, files=None, auto_id=u'id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, field_order=None, use_required_attribute=None)[source]¶ Bases:
registration.forms.RegistrationForm
Subclass of
RegistrationForm
which enforces uniqueness of email address-
base_fields
= OrderedDict([('username', <django.forms.fields.RegexField object at 0x7f2a9a135f10>), ('email1', <django.forms.fields.EmailField object at 0x7f2a9a1400d0>), ('email2', <django.forms.fields.EmailField object at 0x7f2a9a140210>)])¶
-
declared_fields
= OrderedDict([('username', <django.forms.fields.RegexField object at 0x7f2a9a135f10>), ('email1', <django.forms.fields.EmailField object at 0x7f2a9a1400d0>), ('email2', <django.forms.fields.EmailField object at 0x7f2a9a140210>)])¶
-
media
¶
-
registration.models module¶
registration.signals module¶
registration.urls module¶
registration.utils module¶
-
registration.utils.
generate_activation_key
(username)[source]¶ generate activation key with username
originally written by ubernostrum in django-registration
-
registration.utils.
generate_random_password
(length=10)[source]¶ generate random password with passed length
-
registration.utils.
get_site
(request)[source]¶ get current
django.contrib.Site
instancereturn
django.contrib.RequestSite
instance when theSite
is not installed.
-
registration.utils.
send_mail
(subject, message, from_email, recipients)[source]¶ send mail to recipients
this method use django-mailer
send_mail
method when the app is inINSTALLED_APPS
Note
django-mailer
send_mail
is not used duaring unittest because it is a little bit difficult to check the number of mail sent in unittest for both django-mailer and original djangosend_mail
registration.views module¶
-
class
registration.views.
ActivationCompleteView
(**kwargs)[source]¶ Bases:
django.views.generic.base.TemplateView
A simple template view for activation complete
-
template_name
= u'registration/activation_complete.html'¶
-
-
class
registration.views.
ActivationView
(*args, **kwargs)[source]¶ Bases:
django.views.generic.base.TemplateResponseMixin
,django.views.generic.edit.FormMixin
,django.views.generic.detail.SingleObjectMixin
,django.views.generic.edit.ProcessFormView
A complex view for activation
- GET:
- Display an ActivationForm which has
password1
andpassword2
for activation user who hasactivation_key
password1
andpassword2
should be equal to prepend typo - POST:
- Activate the user who has
activation_key
with passedpassword1
-
form_valid
(form)[source]¶ activate user who has
activation_key
withpassword1
this method is called when form validation has successed.
-
get_object
(queryset=None)[source]¶ get
RegistrationProfile
instance byactivation_key
activation_key
should be passed by URL
-
model
¶ alias of
RegistrationProfile
-
template_name
= u'registration/activation_form.html'¶
-
class
registration.views.
RegistrationClosedView
(**kwargs)[source]¶ Bases:
django.views.generic.base.TemplateView
A simple template view for registraion closed
This view is called when user accessed to RegistrationView with REGISTRATION_OPEN = False
-
template_name
= u'registration/registration_closed.html'¶
-
-
class
registration.views.
RegistrationCompleteView
(**kwargs)[source]¶ Bases:
django.views.generic.base.TemplateView
A simple template view for registration complete
-
template_name
= u'registration/registration_complete.html'¶
-
-
class
registration.views.
RegistrationView
(*args, **kwargs)[source]¶ Bases:
django.views.generic.edit.FormMixin
,django.views.generic.base.TemplateResponseMixin
,django.views.generic.edit.ProcessFormView
A complex view for registration
- GET:
Display an RegistrationForm which has
username
,email1
andemail2
for registration.email1
andemail2
should be equal to prepend typo.form
andsupplement_form
is in context to display these form.- POST:
- Register the user with passed
username
andemail1
-
form_valid
(form, supplement_form=None)[source]¶ register user with
username
andemail1
this method is called when form validation has successed.
-
template_name
= u'registration/registration_form.html'¶
Module contents¶
The difference between django-registration¶
While django-registration requires 3 steps for registration, django-inspectional-registration requires 5 steps and inspector for registration. See the conceptual summary below.

For translators¶
You can compile the latest message files with the following command
$ python setup.py compile_messages
The command above is automatically called before sdist
command if you call
python manage.py sdist
.
Backward incompatibility¶
Because of an issue#24, django-inspectional-registration add the following three new options.
REGISTRATION_DJANGO_AUTH_URLS_ENABLE
If it isFalse
, django-inspectional-registration do not define the views of django.contrib.auth. It is required to define these view manually. (Default:True
)REGISTRATION_DJANGO_AUTH_URL_NAMES_PREFIX
It is used as a prefix string of view names of django.contrib.auth. For backward compatibility, set this value to'auth_'
. (Default:''
)REGISTRATION_DJANGO_AUTH_URL_NAMES_SUFFIX
It is used as a suffix string of view names of django.contrib.auth. For backward compatibility, set this value to''
. (Default:''
)
This changes were introduced from version 0.4.0, to keep the backward compatibility, write the following in your settings module.
REGISTRATION_DJANGO_AUTH_URLS_ENABLE = True
REGISTRATION_DJANGO_AUTH_URL_NAMES_PREFIX = 'auth_'
REGISTRATION_DJANGO_AUTH_URL_NAMES_SUFFIX = ''