Django Template Tags and Filters
The purpose of this website is to provide useful documentation on Django’s 64 template filters and 35 template tags. While the official documentation is very good, we have attempted to organize the tags and filters in a more meaningful way, and to give a better sense of how and if/when to use each one.
Filters
Coding Filters
addslashes
escape
escapejs
escapeseq
New in Django 5.0
force_escape
json_script
Most useful
linebreaks
linebreaksbr
pprint
safe
Most useful
striptags
Data Structure Filters
Date and Time Filters
date
Most useful
naturalday
Needs {% load humanize %}, and django.contrib.humanize in INSTALLED_APPS
naturaltime
Needs {% load humanize %}, and django.contrib.humanize in INSTALLED_APPS
Most useful
time
Most useful
timesince
Most useful
timeuntil
Most useful
Formatting Filters
Logic Filters
Number Filters
add
apnumber
Needs {% load humanize %}, and django.contrib.humanize in INSTALLED_APPS
divisibleby
filesizeformat
Most useful
floatformat
Most useful
get_digit
intcomma
Needs {% load humanize %}, and django.contrib.humanize in INSTALLED_APPS
Most useful
intword
Needs {% load humanize %}, and django.contrib.humanize in INSTALLED_APPS
length
Most useful
ordinal
Needs {% load humanize %}, and django.contrib.humanize in INSTALLED_APPS
wordcount
String Filters
cut
linenumbers
phone2numeric
pluralize
Most useful
stringformat
truncatechars
truncatechars_html
truncatewords
truncatewords_html
Most useful
wordwrap
URL Filters
Tags
Coding Tags
Logic Tags
cycle
Most useful
firstof
for
Most useful
for … empty
Most useful
if
Most useful
ifchanged
ifequal
Removed in Django 4.0
ifnotequal
Removed in Django 4.0
resetcycle
with
Most useful
Utility Tags
block
Most useful
cache
Needs {% load cache %}
Most useful
comment
Most useful
csp_nonce_attr
New in Django 6.1
csrf_token
Most useful
debug
extends
Most useful
filter
get_media_prefix
Needs {% load static %}
get_static_prefix
Needs {% load static %}
include
Most useful
load
Most useful
lorem
now
partial
New in Django 6.0
Most useful
partialdef
New in Django 6.0
Most useful
querystring
New in Django 5.1
Most useful
regroup
static
Needs {% load static %}
Most useful
url
Most useful
