Mixins (feincms3.mixins)#

class feincms3.mixins.LanguageAndTranslationOfMixin(*args, **kwargs)[source]#

This object not only has a language, it may also be a translation of another object.

clean_fields(exclude=None)[source]#

Implement the following validation rules:

  • Objects in the primary language cannot be the translation of another object

  • Objects in other languages can only reference objects in the primary language (this is automatically verified by Django because we’re using limit_choices_to)

translations()[source]#

Return a queryset containing all translations of this object

This method can be called on any object if translations have been defined at all, you do not have to fetch the object in the primary language first.

class feincms3.mixins.LanguageMixin(*args, **kwargs)[source]#

Pages may come in varying languages. LanguageMixin helps with that.

activate_language(request)[source]#

activate() the page’s language and set request.LANGUAGE_CODE

class feincms3.mixins.MenuMixin(*args, **kwargs)[source]#

The MenuMixin is most useful on pages where there are menus with differing content on a single page, for example the main navigation and a meta navigation (containing contact, imprint etc.)

static fill_menu_choices(sender, **kwargs)[source]#

Fills in the choices for menu from the MENUS class variable. This method is a receiver of Django’s class_prepared signal.

class feincms3.mixins.RedirectMixin(*args, **kwargs)[source]#

The RedirectMixin allows adding redirects in the page tree.

clean_fields(exclude=None)[source]#

Ensure that redirects are configured properly.

get_redirect_url()[source]#

Return the URL for the redirect, if a redirect is configured

class feincms3.mixins.TemplateMixin(*args, **kwargs)[source]#

It is sometimes useful to have different templates for CMS models such as pages, articles or anything comparable. The TemplateMixin provides a ready-made solution for selecting django-content-editor Template instances through Django’s administration interface.

Warning

You are encouraged to use the PageTypeMixin and TemplateType from feincms3.applications instead.

static fill_template_key_choices(sender, **kwargs)[source]#

Fills in the choices for menu from the MENUS class variable. This method is a receiver of Django’s class_prepared signal.

property regions#

Return the selected template instances’ regions attribute, falling back to an empty list if no template instance could be found.

property template#

Return the selected template instance if the template_key field matches, or falls back to the first template in TEMPLATES.