Template tags

FeinCMS tags

feincms.templatetags.feincms_tags.feincms_frontend_editing(cms_obj, request)

{% feincms_frontend_editing feincms_page request %}

feincms.templatetags.feincms_tags.feincms_load_singleton(template_key, cls=None)

{% feincms_load_singleton template_key %} – return a FeinCMS Base object which uses a Template with singleton=True.

feincms.templatetags.feincms_tags.feincms_render_content(context, content, request=None)

{% feincms_render_content content request %}

feincms.templatetags.feincms_tags.feincms_render_region(context, feincms_object, region, request=None)

{% feincms_render_region feincms_page “main” request %}

feincms.templatetags.feincms_tags.feincms_singleton_url(template_key, cls=None)

{% feincms_singleton_url template_key %} – return the URL of a FeinCMS Base object which uses a Template with singleton=True.

feincms.templatetags.feincms_tags.show_content_type_selection_widget(context, region)

{% show_content_type_selection_widget region %}

Thumbnail filters

feincms.templatetags.feincms_thumbnail.cropscale(filename, size='200x200')

Scales the image down and crops it so that its size equals exactly the size passed (as long as the initial image is bigger than the specification).

feincms.templatetags.feincms_thumbnail.thumbnail(filename, size='200x200')

Creates a thumbnail from the image passed, returning its path:

{{ object.image|thumbnail:"400x300" }}
{{ object.image.name|thumbnail:”400x300” }}

You can pass either an ImageField, FileField or the name but not the url attribute of an ImageField or FileField.

The dimensions passed are treated as a bounding box. The aspect ratio of the initial image is preserved. Images aren’t blown up in size if they are already smaller.

Both width and height must be specified. If you do not care about one of them, just set it to an arbitrarily large number:

{{ object.image|thumbnail:"300x999999" }}

Page-module specific tags

ApplicationContent tags

feincms.templatetags.applicationcontent_tags.app_reverse(parser, token)

Returns an absolute URL for applications integrated with ApplicationContent

The tag mostly works the same way as Django’s own {% url %} tag:

{% load applicationcontent_tags %}
{% app_reverse "mymodel_detail" "myapp.urls" arg1 arg2 %}


{% load applicationcontent_tags %}
{% app_reverse "mymodel_detail" "myapp.urls" name1=value1 name2=value2 %}

The first argument is a path to a view. The second argument is the URLconf under which this app is known to the ApplicationContent. The second argument may also be a request object if you want to reverse an URL belonging to the current application content.

Other arguments are space-separated values that will be filled in place of positional and keyword arguments in the URL. Don’t mix positional and keyword arguments.

If you want to store the URL in a variable instead of showing it right away you can do so too:

{% app_reverse "mymodel_detail" "myapp.urls" arg1 arg2 as url %}
feincms.templatetags.applicationcontent_tags.feincms_render_region_appcontent(page, region, request)

Render only the application content for the region

This allows template authors to choose whether their page behaves differently when displaying embedded application subpages by doing something like this:

{% if not in_appcontent_subpage %}
    {% feincms_render_region feincms_page "main" request %}
{% else %}
    {% feincms_render_region_appcontent feincms_page "main" request %}
{% endif %}
feincms.templatetags.fragment_tags.fragment(parser, token)

Appends the given content to the fragment. Different modes (replace, append) are available if specified.


{% fragment request "title" %} content ... {% endfragment %}


{% fragment request "title" (prepend|replace|append) %} content ... {% endfragment %}
feincms.templatetags.fragment_tags.get_fragment(parser, token)

Fetches the content of a fragment.


{% get_fragment request "title" %}


{% get_fragment request "title" as title %}
feincms.templatetags.fragment_tags.has_fragment(request, identifier)

Returns the content of the fragment, despite its name:

{% if request|has_fragment:"title" %} ... {% endif %}

Table Of Contents

Previous topic


Next topic


This Page