Skip to content
Justice Tech School

Filters

Filters change a value with a pipe. Common ones are upper, lower, length, default, date, truncatewords and safe.

Example
{{ name|upper }}
{{ items|length }}
{{ bio|default:"No bio" }}
{{ post.created|date:"Y-m-d" }}
{{ text|truncatewords:20 }}

Exercise

Use a fallback value.

{{ x|:"none" }}

Quiz Test

Which symbol applies a filter?

These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.