Django Tutorial · Django References

Template Tag Reference

Learn all about Template Tag Reference in this comprehensive tutorial.

5 min read intermediate
  • A list of all template tags:

Template Tags Reference

A list of all template tags:

TagDescription
autoescapeSpecifies if autoescape mode is on or off
blockSpecifies a block section
commentSpecifies a comment section
csrf_tokenProtects forms from Cross Site Request Forgeries
cycleSpecifies content to use in each cycle of a loop
debugSpecifies debugging information
extendsSpecifies a parent template
filterFilters content before returning it
firstofReturns the first not empty variable
forSpecifies a for loop
ifSpecifies a if statement
ifchangedUsed in for loops. Outputs a block only if a value has changed since the last iteration
includeSpecifies included content/template
loadLoads template tags from another library
loremOutputs random text
nowOutputs the current date/time
regroupSorts an object by a group
resetcycleUsed in cycles. Resets the cycle
spacelessRemoves whitespace between HTML tags
templatetagOutputs a specified template tag
urlReturns the absolute URL part of a URL
verbatimSpecifies contents that should not be rendered by the template engine
widthratioCalculates a width value based on the ratio between a given value and a max value
withSpecifies a variable to use in the block

Module quiz

2 questions
1

Which of the following is true about Template Tag Reference?

2

What is the most common pitfall when working with Template Tag Reference?

Answer all questions to submit.