With Jinja2, how can I make an iteration like the folllowing which works with django and not Jinja:
{% for key,value in location_map_india.items %}
{{value.name}}
{% endfor %}
The above is valid django but with Jinja2 it returns an error message
TypeError: 'builtin_function_or_method' object is not iterable
Thanks for any advice
In Jinja2, functions and methods must be explicitly called .
{% for key,value in location_map_india.items() %}
{{value.name}}
{% endfor %}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.