Utility Tags
30 tags
- 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
- 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.
- 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_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 %}
- 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
- 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.
- static builds a URL for a static file. Needs {% load static %} Most useful
- 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
