-
-
Notifications
You must be signed in to change notification settings - Fork 12
Templating Reference
For syntax, refer to Django's documentation.
Sets the autoescaping mode. mode may be one of 'off', 'html', 'js-string', 'csv', or to restore the previous mode 'end'.
Outputs all variables accessible at this point in the template as a <dl> list. Intended for debugging purposes, not production.
Evaluates the contained template until {% each %}
to obtain a whitespace seperated list of HTTP or HTTPS URLs to download concurrently. Template rendering resumes after {% endfetch %}
once all URLs have been downloaded.
For each HTTP response obtained from fetch, each renders it's contained template until {% endfetch %}
with the parsed response stored in name.
The response is parsed as TSV or JSON (XML support is planned) according to the MIMEtype given by the server. If that MIMEtype is absent, it will be inferred.
Applies filters to the contained template until {% endfilter %}
. filters uses templating syntax, without the variable path or the preceding |
.
Evaluates the contained template until {% endfor %}
(or {% empty %}
) for each item contained in variable. Each time it assigns the item to value (which must be a global name), and the corrosponding key to key.
Evaluates the contained template until {% endfor %}
if there are no items in variable.
Evaluates the condition, and if truthy evaluates the contained template until {% endif %}
(or {% else %}
or {% elif %}
). The condition is a variable, or variables with infix operators (documented next) between them. Spaces are required between variables and operators.
In order of precedance (lowest binding to highest binding):
or
and
-
not
(prefix) -
<
,>
,<=
,>=
,==
,!=
Any operator may be prefixed with not to negate it.
If the expression evaluated to something falsy, evaluates the contained template until {% endif %}
.
If the expression evaluated to something falsy and the contained template until the next {% elif %}
or {% endif %}
.
Checks if any of the variables have changed since the last time this code was run. If so it runs the embedded template until {% endif %}
(or {% else %}
).
Evaluates if there are no changes.
As per Django.
Translates the contained template until {% endtrans %}
(or {% plural %}
), possibly using the additional variables specified in the tag. It is courtious to avoid markup and templating where possible within the the body of a trans tag. A preceding comment within this template will be split out specially for translators.
Evaluates (in English) if the count
variable indicates the plural form should be used.
Outputs the contained text until {% endverbatim %}
without evaluating any templating.
Evaluates the contained template using the given additional variables.
Where not documented, these should be self-describing. If they're not, please document them here.