registration.supplements package

Submodules

registration.supplements.base module

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 of form_class attribute to determine the form class used for filling up the supplemental informatin in registration view if form_class is specified. Otherwise the method create django’s ModelForm 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 of admin_fields attribute in default. If the method return None, then all fields except id (and fields in admin_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 of admin_excludes attribute in default. If the method return None, then all fields selected with admin_fields except id 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 of RegistrationProfile thus DO NOT CHANGE the name.

class Meta[source]
abstract = False
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 returns None then all fields (selected in admin_fields) except id 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 returns None then all fields except id (and fields in admin_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’s ModelForm, set it to form_class and return it

This 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 a ForwardManyToOneDescriptor 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.

Module contents

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.