registration package

Subpackages

Submodules

registration.compat module

registration.compat.patterns(x, *args)

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''
class Meta[source]
prefix = u'registration'
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.conf.configure_other_settings()[source]

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.

clean_username()[source]

Validate that the username is alphanumeric and is not already in use.

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>)])
clean_email1()[source]

Validate that the supplied email address is unique for the site.

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 instance

return django.contrib.RequestSite instance when the Site 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 in INSTALLED_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 django send_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 and password2 for activation user who has activation_key password1 and password2 should be equal to prepend typo
POST:
Activate the user who has activation_key with passed password1
form_valid(form)[source]

activate user who has activation_key with password1

this method is called when form validation has successed.

get(request, *args, **kwargs)[source]
get_form_class()[source]

get activation form class via backend

get_object(queryset=None)[source]

get RegistrationProfile instance by activation_key

activation_key should be passed by URL

get_queryset()[source]

get RegistrationProfile queryset which status is ‘accepted’

get_success_url()[source]

get activation complete url via backend

model

alias of RegistrationProfile

post(request, *args, **kwargs)[source]
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

get_context_data(**kwargs)[source]
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 and email2 for registration. email1 and email2 should be equal to prepend typo.

form and supplement_form is in context to display these form.

POST:
Register the user with passed username and email1
dispatch(request, *args, **kwargs)[source]
form_invalid(form, supplement_form=None)[source]
form_valid(form, supplement_form=None)[source]

register user with username and email1

this method is called when form validation has successed.

get(request, *args, **kwargs)[source]
get_disallowed_url()[source]

get registration closed url via backend

get_form_class()[source]

get registration form class via backend

get_success_url()[source]

get registration complete url via backend

get_supplement_form(supplement_form_class)[source]

get registration supplement form instance

get_supplement_form_class()[source]

get registration supplement form class via backend

post(request, *args, **kwargs)[source]
template_name = u'registration/registration_form.html'

Module contents