List of Builtin Tests
callable() | even() | le() | none() | string() |
defined() | ge() | lower() | number() | undefined() |
divisibleby() | gt() | lt() | odd() | upper() |
eq() | in() | mapping() | sameas() | |
escaped() | iterable() | ne() | sequence() |
Note that classes are callable, as are instances of classes with acall() method.
{% if variable is defined %}
value of variable: {{ variable }}
{% else %}
variable is not defined
{% endif %}
See the default()
filter for a simple way to set undefinedvariables.
New in version 2.10.
lower
(value)- Return true if the variable is lowercased.
Changelog
New in version 2.6.
{% if foo.attribute is sameas false %}
the foo attribute really is the `False` singleton
{% endif %}
string
(value)- Return true if the object is a string.
undefined
(value)- Like
defined()
but the other way round.
upper
(value)- Return true if the variable is uppercased.