fluent_contents.templatetags.fluent_contents_tags

Changed in version 1.0: The template tag library was called placeholder_tags in the past.

The fluent_contents_tags module provides two template tags for rendering placeholders: It can be loaded using:

{% load fluent_contents_tags %}

A placeholder which is stored in a PlaceholderField can be rendered with the following syntax:

{% render_placeholder someobject.placeholder %}

To support CMS interfaces, placeholder slots can be defined in the template. This is done using the following syntax:

{% page_placeholder currentpage "slotname" %}
{% page_placeholder currentpage "slotname" title="Admin title" role="main" %}

The CMS interface can scan for those tags using the fluent_contents.analyzer module.

The PagePlaceholderNode class

class fluent_contents.templatetags.fluent_contents_tags.PagePlaceholderNode(tag_name, as_var, parent_expr, slot_expr, **kwargs)

The template node of the page_placeholder tag. It renders a placeholder of a provided parent object. The template tag can also contain additional metadata, which can be returned by scanning for this node using the fluent_contents.analyzer module.

get_fallback_language()

Return whether to use the fallback language.

get_role()

Return the string literal that is used in the template. The role can be “main”, “sidebar” or “related”, or shorted to “m”, “s”, “r”.

get_slot()

Return the string literal that is used for the placeholder slot in the template. When the variable is not a string literal, None is returned.

get_title()

Return the string literal that is used in the template. The title is used in the admin screens.

classmethod parse(parser, token)

Parse the node syntax:

{% page_placeholder parentobj slotname title="test" role="m" %}

The RenderPlaceholderNode class

class fluent_contents.templatetags.fluent_contents_tags.RenderPlaceholderNode(tag_name, as_var, *args, **kwargs)

The template node of the render_placeholder tag. It renders the provided placeholder object.

The RenderContentItemsMedia class

class fluent_contents.templatetags.fluent_contents_tags.RenderContentItemsMedia(tag_name, *args, **kwargs)

The template node of the render_plugin_media tag. It renders the media object object.