registration.admin package¶
Submodules¶
registration.admin.forms module¶
-
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 0x7fdaacd8c490>), (u'activate', <django.utils.functional.__proxy__ object at 0x7fdaacd8c4d0>))¶
-
RegistrationAdminForm.
REJECTED_ACTIONS
= ((u'accept', <django.utils.functional.__proxy__ object at 0x7fdaacd8c510>), (u'force_activate', <django.utils.functional.__proxy__ object at 0x7fdaacd8c550>))¶
-
RegistrationAdminForm.
UNTREATED_ACTIONS
= ((u'accept', <django.utils.functional.__proxy__ object at 0x7fdaacd8c410>), (u'reject', <django.utils.functional.__proxy__ object at 0x7fdaacd8c450>), (u'force_activate', <django.utils.functional.__proxy__ object at 0x7fdaacda8750>))¶
-
RegistrationAdminForm.
base_fields
= OrderedDict([('action_name', <django.forms.fields.ChoiceField object at 0x7fdaacd8c5d0>), ('message', <django.forms.fields.CharField object at 0x7fdaacd8c6d0>)])¶
-
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 0x7fdaacd8c5d0>), ('message', <django.forms.fields.CharField object at 0x7fdaacd8c6d0>)])¶
-
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)¶
-
Module contents¶
-
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')¶
-