registration package¶
Subpackages¶
- registration.admin package
- registration.backends package
- registration.contrib package
- registration.management package
- registration.migrations package
- registration.south_migrations package
- registration.supplements package
- registration.tests package
- Submodules
- registration.tests.compat module
- registration.tests.mock module
- registration.tests.test_admin module
- registration.tests.test_backends module
- registration.tests.test_forms module
- registration.tests.test_models module
- registration.tests.test_supplements module
- registration.tests.test_views module
- registration.tests.utils module
- Module contents
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, renderer=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>), ('password2', <django.forms.fields.CharField object>)])¶
-
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>), ('password2', <django.forms.fields.CharField object>)])¶
-
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, renderer=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>), ('email1', <django.forms.fields.EmailField object>), ('email2', <django.forms.fields.EmailField object>)])¶
-
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>), ('email1', <django.forms.fields.EmailField object>), ('email2', <django.forms.fields.EmailField object>)])¶
-
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, renderer=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>), ('email1', <django.forms.fields.EmailField object>), ('email2', <django.forms.fields.EmailField object>)])¶
-
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>), ('email1', <django.forms.fields.EmailField object>), ('email2', <django.forms.fields.EmailField object>)])¶
-
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, renderer=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>), ('email1', <django.forms.fields.EmailField object>), ('email2', <django.forms.fields.EmailField object>), ('tos', <django.forms.fields.BooleanField object>)])¶
-
declared_fields
= OrderedDict([('username', <django.forms.fields.RegexField object>), ('email1', <django.forms.fields.EmailField object>), ('email2', <django.forms.fields.EmailField object>), ('tos', <django.forms.fields.BooleanField object>)])¶
-
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, renderer=None)[source]¶ Bases:
registration.forms.RegistrationForm
Subclass of
RegistrationForm
which enforces uniqueness of email address-
base_fields
= OrderedDict([('username', <django.forms.fields.RegexField object>), ('email1', <django.forms.fields.EmailField object>), ('email2', <django.forms.fields.EmailField object>)])¶
-
declared_fields
= OrderedDict([('username', <django.forms.fields.RegexField object>), ('email1', <django.forms.fields.EmailField object>), ('email2', <django.forms.fields.EmailField object>)])¶
-
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'¶