web.mixins package

web.mixins package containing forms for the Eonvelope webapp views.

class web.mixins.CustomActionMixin[source]

Bases: object

Mixin to provide action button handling for views.

To register handlers for the different actions define a viewclass method handle_action that creates the appropriate response to a action post request.

_handler_method_prefix: Final[str] = 'handle_'

The name prefix of methods considered request handlers.

post(request)[source]

Creates response to a post request.

If no action matches the existing handlers, responds with Http204. Should be executed last in a custom view post method.

Parameters:

request (HttpRequest) – The post request to handle.

Return type:

HttpResponse

Returns:

The handlers response to the request. If no matching handler is found Http204.

Raises:

ImproperlyConfigured – If the called handler method does not return a django.http.HttpResponse.>

class web.mixins.PageSizeMixin[source]

Bases: object

Mixin for pagination with variable page size.

page_size_kwarg = 'page_size'
paginate_by = 25
get_paginate_by(queryset)[source]

Extended method to allow variable page sizes.

Return type:

int

Returns:

The requested page size or the paginate_by value.

Parameters:

queryset (QuerySet)

get_context_data(**kwargs)[source]

Extended method to allow variable page sizes.

Return type:

dict[str, Any]

Returns:

The context with a page_size added to it.

Parameters:

kwargs (Any)

class web.mixins.TestActionMixin[source]

Bases: object

Mixin to provide test button handling for views.

handle_test(request)[source]

Handler function for the test action.

Parameters:

request (HttpRequest) – The action request to handle.

Return type:

HttpResponse

Returns:

A template response with the updated view after the action.

Submodules