fairdm.contrib.admin.sites#

Custom admin site that admits holders of rights-carrying roles.

Module Contents#

Classes#

FixtureUploadForm

Form with a single field for the fixture file to load.

PortalAdminAuthenticationForm

Admin login form that accepts a holder of a rights-carrying role, not only staff.

CustomAdminSite

Admin site titled for the portal that admits holders of rights-carrying roles.

API#

class FixtureUploadForm(data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=ErrorList, label_suffix=None, empty_permitted=False, field_order=None, use_required_attribute=None, renderer=None, bound_field_class=None)#

Bases: django.forms.Form

Form with a single field for the fixture file to load.

Initialization

fixture_file#

‘FileField(…)’

class PortalAdminAuthenticationForm(request=None, *args, **kwargs)#

Bases: django.contrib.admin.forms.AdminAuthenticationForm

Admin login form that accepts a holder of a rights-carrying role, not only staff.

Initialization

The ‘request’ parameter is set for custom auth use by subclasses. The form data comes in via the standard ‘data’ kwarg.

confirm_login_allowed(user)#

Allow staff and holders of a rights-carrying role to sign in.

class CustomAdminSite(name='admin')#

Bases: django.contrib.admin.AdminSite

Admin site titled for the portal that admits holders of rights-carrying roles.

Initialization

site_header#

‘_(…)’

site_title#

‘_(…)’

index_title#

‘_(…)’

login_form#

None

has_permission(request)#

Accept a holder of a rights-carrying role, not only an is_staff account.

get_urls()#

Add the fixture upload route.

upload_fixture_view(request)#

Load an uploaded fixture file and report the outcome.

Args: request: The current request.

Returns: A redirect to the admin index after a valid upload, otherwise the upload form.