jinja built-in
Return whether the object is callable (i.e., some kind of function). Note that classes are callable, as are instances with a call() method.
{{ range is callable }}
# => True
{{ 42 is callable }}
# => False
jinja built-in
Return true if the variable is defined:
{{ missing is defined }}
# => False
{{ true is defined }}
# => True
See the -default- filter for a simple way to set undefined variables.
jinja built-in
Check if a variable is divisible by a number.
# todo: check if it is correct
{{ 20 | divisibleby(5) }}
# => True
jinja built-in
Check if an object has the same value as another object:
{{ foo is equalto 12 }}
# => True
{{ foo is equalto 0 }}
# => False
{{ foo is equalto (3 * 4) }}
# => True
{{ bar is equalto "baz" }}
# => True
{{ bar is equalto "zab" }}
# => False
{{ bar is equalto ("ba" + "z") }}
# => True
{{ bar is equalto bar }}
# => True
{{ bar is equalto foo }}
# => False
This appears to be a useless test as it does exactly the same as the == operator, but it can be useful when used together with the selectattr function:
{{ users|selectattr("email", "equalto", "[email protected]") }}
New in jinja version 2.8.
jinja built-in
Check if the value is escaped.
{{ 'foo' is escaped }
# => False
{{ '<">&' is escaped }}
# => True
jinja built-in
Return true if the variable is even.
{{ 1 is even }}
# => False
{{ 2 is even }}
# => True
jinja built-in
Check if it’s possible to iterate over an object.
{{ range(5) is iterable }}
# => True
{{ 5 is iterable }}
# => False
jinja built-in
Return true if the variable is lowercased.
{{ "foo" is lower }}
# => True
{{ "FOO" is lower }}
# => False
jinja built-in
Return true if the object is a mapping (dict etc.).
{{ {} is mapping }}
# => True
{{ [] is mapping }}
# => False
New in jinja version 2.6.
jinja built-in
Return true if the variable is none.
{{ None is none }}
# => True
{{ 'foo' is none }}
# => False
jinja built-in
Return true if the variable is a number.
{{ 42 is number }}
# => True
{{ (10 ** 100) is number }}
# => True
{{ 3.14159 is number }}
# => True
{{ complex(1,2) is number }}
# => True
jinja built-in
Return true if the variable is odd.
{{ 1 is odd }}
# => True
{{ 2 is odd }}
# => False
jinja built-in
Check if an object points to the same memory address than another object
{{ False is sameas false }}
# => True
{{ 0 is sameas false }}
# => False
jinja built-in
Return true if the variable is a sequence. Sequences are variables that are iterable.
{{ "foo" is sequence }}
# => True
{{ [1] is sequence }}
# => True
jinja built-in
Return true if the object is a string.
{{ 42 is string }}
# => False
{{ "foo" is string }}
# => True
jinja built-in
Like defined() but the other way round.
{{ 42 is undefined }}
# => False
{{ missing is undefined }}
# => True
jinja built-in
Return true if the variable is uppercased.
{{ "FOO" is upper }}
# => True
{{ "foo" is upper }}
# => False