Jinja2 is not Python. It uses syntax like Python, but does not define the same built-in functions.
Use subscription syntax instead; you can use attribute access and subscription in Jinja2:
{{ object[att] }}
or you can use attr()filter :
{{ object|attr(att) }}
In the Variables section of the template design documentation:
(.) Python __getitem__ "[]".
:
{{ foo.bar }}
{{ foo['bar'] }}
, :
foo['bar'] :
'bar' foo. (foo.__getitem__('bar'))- , bar foo. (
getattr(foo, 'bar')) - , undefined.