template_helpers.templatetags

template_helpers.templatetags.template_helpers.set_tag(context, **kwargs)[source]

The set` template tag add one or more context variables to the current template context. The context stack is respected.

{% set foo="bar" baz=1 %}
{{ foo }}
{{ baz }}
template_helpers.templatetags.template_helpers.split(value, sep=' ')[source]

The split template filter splits a given string by spaces. If you want to split by something else, provide the devider as a argument to the filter.

{{ "foo bar"|split }}
{{ "foo-bar"|split"-" }}
template_helpers.templatetags.template_helpers.starspan(value)[source]

The starspan template filter adds extra span element to star indicated text (“*text*”).

{{ some_text_variable|starspan }}
template_helpers.templatetags.template_helpers.merge_list(value, list_to_merge)[source]

The merge_list filter combines two lists.

{% for element in first_list|merge_list:second_list %}
    {{ element }}
{% endfor %}

To make the result list persistent use in combination with set tag.

{% set new_list=first_list|merge_lists:second_list %}
class template_helpers.templatetags.template_helpers.IncludeWithNode(with_object, template_name, *args, extra_context=None, **kwargs)[source]

Bases: django.template.loader_tags.IncludeNode

render(context)[source]

Render the specified template and context. Cache the template object in render_context to avoid reparsing and loading when used in a for loop.

template_helpers.templatetags.template_helpers.do_include_with(parser, token)[source]

Include template with object attributes injected to context. It takes object and template path as arguments. Object should have template_exposed_attributes list defined.

{% include_with obj 'path/to/included/template.html' %}

It is also possible to overvrite / add additional kwaegs.

{% include_with obj 'path/to/included/template.html' foo='bar'%}