Skip to content

Template Tags

template_helpers

divide_list = register.tag(divide_list) module-attribute

Split a list into chunks for column-based rendering.

Usage: {% list_to_columns my_list as chunked_list 3 %}

Parameters:

Name Type Description Default
parser

Django template parser.

required
token

Template tag token.

required

Returns:

Name Type Description
SplitListNode

Node that splits the list in the template context.

SplitListNode(original_list, items_per_list, new_list)

Bases: Node

Template node that splits a list into chunks of a given size.

multiply(invoice, len)

Multiply an invoice's last_page_count by the given length.

get_item(dictionary, key)

Template filter to access a dictionary value by key.

Usage: {{ my_dict|get_item:key_var }}

get_attr(obj, attr)

Template filter to access an object attribute by name.

Usage: {{ my_obj|get_attr:"field_name" }}

contains(value, target)

Case-insensitive substring check.

Usage: {{ value|contains:"search" }}

as_currency(value, decimal_precision=2)

Format a value as currency with the given decimal precision.

Usage: {{ amount|as_currency }} or {{ amount|as_currency:0 }}

concat_all(*args)

concatenate all args

strip_tags(value)

Remove all HTML tags from a string.

Usage: {{ html_content|strip_tags }}

dynamic_formset(formset, tabular=False, add_button_text=None)

Render a dynamic Django formset with add/remove functionality.

Parameters:

Name Type Description Default
formset

Django formset instance.

required
tabular

If True, render in tabular layout.

False
add_button_text

Custom text for the add button.

None

replace_new_line_with_br(value)

Replace newline characters with <br/> HTML tags.

Usage: {{ text|replace_new_line_with_br }}

theme_override_color()

Return the configured theme override colors from admin theme settings.