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.

__init__(tag_name, as_var, parent_expr, slot_expr, **kwargs)

The constructor receives the parsed arguments. The values are stored in tagname, args, kwargs.

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.

get_value(context, *tag_args, **tag_kwargs)

Return the value for the tag.

Parameters:
  • tag_args
  • tag_kwargs
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.

get_value(context, *tag_args, **tag_kwargs)

Return the value for the tag.

Parameters:
  • tag_args
  • tag_kwargs
classmethod validate_args(tag_name, *args, **kwargs)

Validate the syntax of the template tag.

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.

render_tag(context, media_type=None, domain=None)

Render the tag, with all arguments resolved to their actual values.

classmethod validate_args(tag_name, *args, **kwargs)

Validate the syntax of the template tag.