Template tags (feincms3.templatetags.feincms3)

feincms3.templatetags.feincms3.maybe_target_blank(href, *, attributes='target="_blank" rel="noopener"')[source]

Return the value of attributes if the first argument isn’t a first party link (as determined by is_first_party_link())

Usage:

<a href="{{ url }}" {% maybe_target_blank url %}>...</a>
feincms3.templatetags.feincms3.render_region(context, regions, region, **kwargs)[source]

Render a single region. See RegionRenderer for additional details.

Usage:

{% render_region regions "main" %}
feincms3.templatetags.feincms3.reverse_app(parser, token)[source]

Reverse app URLs, preferring the active language.

Usage:

{% load feincms3 %}
{% reverse_app 'blog' 'detail' [args] [kw=args] [fallback='/'] %}

namespaces can either be a list or a comma-separated list of namespaces. NoReverseMatch exceptions can be avoided by providing a fallback as a keyword argument or by saving the result in a variable, similar to {% url 'view' as url %} does:

{% reverse_app 'newsletter' 'subscribe-form' fallback='/newsletter/' %}

Or:

{% reverse_app 'extranet' 'login' as login_url %}
feincms3.templatetags.feincms3.translations(iterable, languages=None)[source]

Return a list of dictionaries, one for each language in settings.LANGUAGES. An example follows:

[
    {"code": "en", "name": "English", "object": <instance>},
    {"code": "de", "name": "German", "object": None},
    # ...
]

The filter accepts anything you throw at it. “It” should be an iterable of objects having a language_code property however, or anything non-iterable (such as None). The filter always returns a list of all languages in settings.LANGUAGES but the object key’s value will always be None if the data is unusable.