6.5. Templatetags¶
Argument |
Outputs |
---|---|
openblock |
{% |
closeblock |
%} |
openvariable |
{{ |
closevariable |
}} |
openbrace |
{ |
closebrace |
} |
opencomment |
{# |
closecomment |
#} |
6.5.1. Filters¶
lower
upper
title
date
default
timezone
custom filters
{% load tz %}
{{ value|timezone:"Europe/Paris" }}
{% load tz %}
{{ value|utc }}
{% load tz %}
{{ value|localtime }}
6.5.2. Float Format¶
If the argument passed to floatformat has the g suffix, it will force grouping by the THOUSAND_SEPARATOR for the active locale. For example, when the active locale is en (English):
Value |
Template |
Output |
|
---|---|---|---|
34232.34 |
{{ value|floatformat:"2g" }} |
34 |
232.34 |
34232.06 |
{{ value|floatformat:"g" }} |
34 |
232.1 |
34232.00 |
{{ value|floatformat:"-3g" }} |
34 |
232 |
6.5.3. Simple Tags¶
trans
custom tags
6.5.4. Assignment tags¶
6.5.5. Block tags¶
custom block tags
{% load tz %}
{% localtime on %}
{{ value }}
{% endlocaltime %}
{% localtime off %}
{{ value }}
{% endlocaltime %}
{% load tz %}
{% timezone "Europe/Paris" %}
Paris time: {{ value }}
{% endtimezone %}
{% timezone None %}
Server time: {{ value }}
{% endtimezone %}