Tags
49 tags
- autoescape turns autoescaping of HTML on or off.
- block delineates a block of content that can be overwritten in child templates. Most useful
- blocktrans older spelling of blocktranslate. Needs {% load i18n %}
- blocktranslate translates a block containing variables. Needs {% load i18n %} Most useful
- cache caches part of a template. Needs {% load cache %} Most useful
- comment used to comment out code. Most useful
-
csp_nonce_attr
renders the CSP nonce attribute on
<script>and<link>tags. New in Django 6.1 - csrf_token protects against cross site request forgery. Most useful
- cycle cycles through list of arguments. Most useful
- debug outputs debugging information.
- extends signals that the template extends a parent template. Most useful
- 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. Most useful
- for … empty display text when for loop is empty. Most useful
- get_available_languages lists the languages the site offers. Needs {% load i18n %}
- get_current_language puts the active language code in a variable. Needs {% load i18n %}
- get_current_language_bidi says whether the active language is right-to-left. Needs {% load i18n %}
- get_current_timezone puts the active time zone in a variable. Needs {% load tz %}
- get_language_info looks up the details of one language. Needs {% load i18n %}
- get_language_info_list looks up details for several languages. Needs {% load i18n %}
- get_media_prefix puts MEDIA_URL into the template. Needs {% load static %}
- get_static_prefix puts STATIC_URL into the template. Needs {% load static %}
- if if condition. Most useful
- ifchanged checks if value in loop has changed since last iteration.
-
ifequal
Removed. Use
{% if a == b %}instead. Removed in Django 4.0 -
ifnotequal
Removed. Use
{% if a != b %}instead. Removed in Django 4.0 - include used to include one template in another. Most useful
- language switches the active language for a block. Needs {% load i18n %}
- load used to load one or more libraries of tags and filters. Most useful
- localize turns localized formatting on or off for a block. Needs {% load l10n %}
- localtime turns datetime conversion on or off for a block. Needs {% load tz %}
- lorem outputs lorem ipsum placeholder text.
- now outputs the current date and/or time.
-
partial
renders a template fragment defined with
partialdef. New in Django 6.0 Most useful - partialdef defines a reusable template fragment. New in Django 6.0 Most useful
- querystring outputs a URL-encoded query string. New in Django 5.1 Most useful
- 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.
- static builds a URL for a static file. Needs {% load static %} Most useful
- templatetag Outputs special characters used to create template tags.
- timezone renders a block in a specific time zone. Needs {% load tz %}
- trans older spelling of translate. Needs {% load i18n %}
- translate marks a string for translation. Needs {% load i18n %} Most useful
-
url
used to output the path to the view mapping to
urlnameas defined in the URLConf file. Most useful - verbatim turn off template rendering.
- widthratio used to create bar charts and the like.
- with caches a variable for reuse. Most useful
