Coding Filters
11 filters
- addslashes adds backslashes before quotation marks to escape them.
- escape escapes HTML characters.
- escapejs escapes characters used in JavaScript strings.
-
escapeseq
applies the
escapefilter to each element of a sequence. New in Django 5.0 -
force_escape
Almost identical to
escape. -
json_script
outputs a Python object as JSON inside of a
scriptelement. Most useful -
linebreaks
converts newlines to
<br>and<p>tags. -
linebreaksbr
converts all newline characters in
valueto<br>tags. - pprint Pretty prints a Python object. Used for debugging.
- safe indicates that the value is known to be safe and therefore does not need to be escaped. Most useful
- striptags strips HTML tags.
