Mixins

evileg_core.mixins module

class evileg_core.mixins.EActionFormMixin[source]

Bases: object

action_form

alias of evileg_core.forms.EActionForm

actions = None
get(request, *args, **kwargs)[source]
get_action(action)[source]

Return a given action from a parameter, which can either be a callable, or the name of a method on the Mixin. Return is a tuple of (callable, name, description).

get_action_choices(request, default_choices=[('', '---------')])[source]

Return a list of choices for use in a form object. Each choice is a tuple (name, description).

get_actions(request)[source]

Return a dictionary mapping the names of all actions for this Mixin to a tuple of (callable, name, description) for each action.

get_context_data(**kwargs)[source]
message_user(request, message, level=20, extra_tags='', fail_silently=False)[source]

Send a message to the user. The default implementation posts a message using the django.contrib.messages backend.

Exposes almost the same API as messages.add_message(), but accepts the positional arguments in a different order to maintain backwards compatibility. For convenience, it accepts the level argument as a string rather than the usual level number.

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

Handle an action. This is called if a request is POSTed to the changelist; it returns an HttpResponse if the action was handled, and None otherwise.

class evileg_core.mixins.EAjaxableMixin[source]

Bases: object

Ajaxable mixin for adding ajax methods to view. If method not exists, then try to invoke common method. For example, call get_ajax() for ajax request if this method exists, otherwise call get() method

dispatch(request, *args, **kwargs)[source]
class evileg_core.mixins.EBreadCrumbListMixin[source]

Bases: object

get_breadcrumb_list(**kwargs)[source]
get_context_data(**kwargs)[source]
class evileg_core.mixins.EInUserProfileMixin[source]

Bases: object

dispatch(request, *args, **kwargs)[source]
get_context_data(**kwargs)[source]
user_profile = None
class evileg_core.mixins.EInterfaceMixin[source]

Bases: object

Interface Mixin for representation object in the templates. It is needed to creating a uniform interface in all content objects.

All content objects has several types of representation.

You can override this template in class of content, or globally in the settings.py of your django project.

Parameters
  • TEMPLATE_FULL – full template representation

  • TEMPLATE_PREVIEW – preview template representation

  • TEMPLATE_INFO – information template representation, commonly it has smaller info than TEMPLATE_PREVIEW

  • TEMPLATE_MAIL – template representation for rendering this content in mail

TEMPLATE_FULL = 'evileg_core/objects/full.html'
TEMPLATE_INFO = 'evileg_core/objects/info.html'
TEMPLATE_MAIL = 'evileg_core/objects/mail.html'
TEMPLATE_PREVIEW = 'evileg_core/objects/preview.html'
edit_url_name = None
editable()[source]
get_edit_url()[source]
get_meta_description()[source]
get_preview(*args, **kwargs)[source]
get_self()[source]
get_title()[source]
property parent
was_edited()[source]
class evileg_core.mixins.EPaginateMixin[source]

Bases: object

Mixin for adding page pagination functionality into Class Based View. Mixin support get and post requests

get_paginated_page(objects, number=10)[source]

Method get queryset for creating paginated page by page number form request

Parameters
  • objects – QuerySet or objects list

  • number – number of objects on the page

Returns

page with objects

get_pagination_url()[source]

Method for creating pagination url for bootstrap_pagination from django-bootstrap4

Returns

pagination url

class evileg_core.mixins.EPostFormMixin[source]

Bases: django.views.generic.edit.FormMixin

Mixin for call form_valid() and from_invalid() methods for post requests

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