Tags
- autoescape - turns autoescaping of HTML on or off.
- block - delineates a block of content that can be overwritten in child templates.
- comment - used to comment out code.
- csrf_token - protects against cross site request forgery.
- cycle - cycles through list of arguments.
- debug - outputs debugging information.
- extends - signals that the template extends a parent template.
- filter - applies a pipe-delimited list of filters to the contained content.
-
firstof
- returns the first argument in a list of arguments that evaluates to
True
. - for - for loop.
- for … empty - display text when for loop is empty.
- if - if condition.
- ifchanged - checks if value in loop has changed since last iteration.
-
ifequal
- use
{% if a == b %}
instead. -
ifnotequal
- use
{% if a != b %}
instead. - include - used to include one template in another.
- load - used to load one or more libraries of tags and filters.
- lorem - outputs lorem ipsum placeholder text.
- now - outputs the current date and/or time.
- regroup - used for outputting list of dictionaries in different orders and structures.
-
resetcycle
- used to reset a
cycle
. - spaceless - removes irrelevant whitespace between HTML tags.
- templatetag - Outputs special characters used to create template tags.
-
url
- used to output the path to the view mapping to
urlname
as defined in the URLConf file. - verbatim - turn off template rendering.
- widthratio - used to create bar charts and the like.
- with - caches a variable for reuse.