Most Useful Filters
- date - for formatting dates.
-
default
- used to provide a default string when the variable evaluates to
False
. - filesizeformat - converts a value in bytes to a friendly file size format.
-
floatformat
- rounds a float to
n
decimal places. -
json_script
- outputs a Python object as JSON inside of a
script
element. - length - returns the length of a value.
- pluralize - returns a pluralization suffix.
- safe - indicates that the value is known to be safe and therefore does not need to be escaped.
- slice - returns a slice of a sequence.
- time - for formatting times.
-
timesince
- outputs the amount of time between the value and
to_date
. -
timeuntil
- outputs the amount of time between
from_date
and the value. -
truncatewords_html
- truncates a value to
n
words and appends an ellipsis (…). Smart about HTML tags. - urlencode - escapes a string for use in a URL.
-
yesno
- maps
True
,False
, andNone
to mapped values.