Built-in Django filters

Django filters are designed to format template variables. The syntax to apply Django filters is the vertical bar character | also known as 'pipe' in Unix environments (e.g.{{variable|filter}}). It's worth mentioning that it's possible to use multiple filters on the same variable (e.g.{{variable|filter|filter}}).

I'll classify each built-in Django filter into functional sections so it's easier to identify them. The functional classes I'll use are: Dates, Strings, Lists, Numbers, Dictionaries, Spacing and special characters, Development and Testing & Urls.

Tip You can apply Django filters to entire sections with the {% filter %} tag. If you have a group of variables in the same section and want to apply the same filter to all of them, it's easier to use the {% filter %} tag than to individually declare the filter on each variable. The next section in this chapter on Django built-in tags provides more details on the {% filter %} tag

Dates