AKModel.metaviews.admin module

class AKModel.metaviews.admin.EventSlugMixin[source]

Bases: object

Mixin to handle views with event slugs

This will make the relevant event available as self.event in all kind types of requests (generic GET and POST views, list views, dispatching, create views)

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

Override GET request handling to perform loading event first

post(request, *args, **kwargs)[source]

Override POST request handling to perform loading event first

list(request, *args, **kwargs)[source]

Override list view request handling to perform loading event first

create(request, *args, **kwargs)[source]

Override create view request handling to perform loading event first

dispatch(request, *args, **kwargs)[source]

Override dispatch which is called in many generic views to perform loading event first

get_context_data(*, object_list=None, **kwargs)[source]

Override get_context_data to make the event information available in the rendering context as event. too

class AKModel.metaviews.admin.FilterByEventSlugMixin[source]

Bases: EventSlugMixin

Mixin to filter different querysets based on a event slug from the request url

get_queryset()[source]

Get adapted queryset: Filter current queryset based on url event slug or return 404 if event slug is invalid :return: Queryset

class AKModel.metaviews.admin.AdminViewMixin[source]

Bases: object

Mixin to provide context information needed in custom admin views

Will either use default information for site_url and title or allows to set own values for that

get_context_data(**kwargs)[source]

Extend context

class AKModel.metaviews.admin.IntermediateAdminView(**kwargs)[source]

Bases: AdminViewMixin, FormView

Metaview: Handle typical “action but with preview and confirmation step before” workflow

form_class

alias of AdminIntermediateForm

get_preview()[source]

Render a preview of the action to be performed. Default is empty :return: preview (html) :rtype: str

class AKModel.metaviews.admin.WizardViewMixin[source]

Bases: object

Mixin to create wizard-like views. This visualizes the progress of the user in the creation process and provides the interlinking to the next step

In the current implementation, the steps of the wizard are hardcoded here, hence this mixin can only be used for the event creation wizard

get_context_data(**kwargs)[source]

Extend context

class AKModel.metaviews.admin.IntermediateAdminActionView(**kwargs)[source]

Bases: IntermediateAdminView, ABC

Abstract base view: Intermediate action view (preview & confirmation see IntermediateAdminView) for custom admin actions (marking multiple objects in a django admin model instances list with a checkmark and then choosing an action from the dropdown).

This will automatically handle the decoding of the URL encoding of the list of primary keys django does to select which objects the action should be run on, then display a preview, perform the action after confirmation and redirect again to the object list including display of a confirmation message

form_class

alias of AdminIntermediateActionForm

get_queryset(pks=None)[source]

Get the queryset of objects to perform the action on

abstract action(form)[source]

The real action to perform :param form: form holding the data probably needed for the action

class AKModel.metaviews.admin.LoopActionMixin[source]

Bases: ABC

Mixin for the typical kind of action where one needs to loop over all elements and perform a certain function on each of them

The action is performed by overriding perform_action(self, entity) further customization can be reached with the two callbacks pre_action() and post_action() that are called before and after performing the action loop

action(form)[source]

The real action to perform. Will perform the loop, perform the action on each aelement and call the callbacks

Parameters:

form – form holding the data probably needed for the action

abstract perform_action(entity)[source]

Action to perform on each entity

Parameters:

entity – entity to perform the action on

pre_action()[source]

Callback for custom action before loop starts

post_action()[source]

Callback for custom action after loop finished