Most Useful Filters
15 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
ndecimal places. -
json_script
outputs a Python object as JSON inside of a
scriptelement. - 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_dateand the value. -
truncatewords_html
truncates a value to
nwords and appends an ellipsis (…). Smart about HTML tags. - urlencode escapes a string for use in a URL.
-
yesno
maps
True,False, andNoneto mapped values.
