mixins Package

mixins Package

Mixins for Zinnia views

archives Module

Mixins for Zinnia archive views

class zinnia.views.mixins.archives.ArchiveMixin

Bases: object

Mixin centralizing the configuration of the archives views.

allow_empty = True
allow_future = True
date_field = 'publication_date'
month_format = '%m'
paginate_by = 10
week_format = '%W'
class zinnia.views.mixins.archives.PreviousNextPublishedMixin

Bases: object

Mixin for correcting the previous/next context variable to return dates with published datas.

get_next_day(date)

Get the next day with published entries.

get_next_month(date)

Get the next month with published entries.

get_next_week(date)

Get the next week with published entries.

get_next_year(date)

Get the next year with published entries.

get_previous_day(date)

Get the previous day with published entries.

get_previous_month(date)

Get the previous month with published entries.

get_previous_next_published(date)

Returns a dict of the next and previous date periods with published entries.

get_previous_week(date)

Get the previous wek with published entries.

get_previous_year(date)

Get the previous year with published entries.

callable_queryset Module

Callable Queryset mixins for Zinnia views

class zinnia.views.mixins.callable_queryset.CallableQuerysetMixin

Bases: object

Mixin for handling a callable queryset, which will force the update of the queryset. Related to issue http://code.djangoproject.com/ticket/8378

get_queryset()

Check that the queryset is defined and call it.

queryset = None

entry_cache Module

Cache mixins for Zinnia views

class zinnia.views.mixins.entry_cache.EntryCacheMixin

Bases: object

Mixin implementing cache on get_object method.

get_object(queryset=None)

Implement cache on get_object method to avoid repetitive calls, in POST.

entry_preview Module

Preview mixins for Zinnia views

class zinnia.views.mixins.entry_preview.EntryPreviewMixin

Bases: object

Mixin implementing the preview of Entries.

get_object(queryset=None)

If the status of the entry is not PUBLISHED, a preview is requested, so we check if the user has the ‘zinnia.can_view_all’ permission or if it’s an author of the entry.

entry_protection Module

Protection mixins for Zinnia views

class zinnia.views.mixins.entry_protection.EntryProtectionMixin

Bases: zinnia.views.mixins.entry_protection.LoginMixin, zinnia.views.mixins.entry_protection.PasswordMixin

Mixin returning a login view if the current entry need authentication and password view if the entry is protected by a password.

get(request, *args, **kwargs)

Do the login and password protection.

post(request, *args, **kwargs)

Do the login and password protection.

session_key = 'zinnia_entry_%s_password'
class zinnia.views.mixins.entry_protection.LoginMixin

Bases: object

Mixin implemeting a login view configurated for Zinnia.

login()

Return the login view.

class zinnia.views.mixins.entry_protection.PasswordMixin

Bases: object

Mixin implementing a password view configurated for Zinnia.

error = False
password()

Return the password view.

templates Module

Template mixins for Zinnia views

class zinnia.views.mixins.templates.EntryArchiveTemplateResponseMixin

Bases: zinnia.views.mixins.templates.EntryQuerysetArchiveTemplateResponseMixin

Same as EntryQuerysetArchiveTemplateResponseMixin but use the template defined in the Entry instance as the base template name.

get_default_base_template_names()

Return the Entry.template value.

class zinnia.views.mixins.templates.EntryQuerysetArchiveTemplateResponseMixin

Bases: django.views.generic.base.TemplateResponseMixin

Return a custom template name for the archive views based on the type of the archives and the value of the date.

get_archive_part_value(part)

Method for accessing to the value of self.get_year(), self.get_month(), etc methods if they exists.

get_default_base_template_names()

Return a list of default base templates used to build the full list of templates.

get_template_names()

Return a list of template names to be used for the view.

template_name_suffix = '_archive'
class zinnia.views.mixins.templates.EntryQuerysetArchiveTodayTemplateResponseMixin

Bases: zinnia.views.mixins.templates.EntryQuerysetArchiveTemplateResponseMixin

Same as EntryQuerysetArchiveTemplateResponseMixin but use the current date of the day when getting archive part values.

get_archive_part_value(part)

Return archive part for today

today = None
class zinnia.views.mixins.templates.EntryQuerysetTemplateResponseMixin

Bases: django.views.generic.base.TemplateResponseMixin

Return a custom template name for views returning a queryset of Entry filtered by another model.

get_model_name()

Return the model name for templates.

get_model_type()

Return the model type for templates.

get_template_names()

Return a list of template names to be used for the view.

model_name = None
model_type = None