How can I do this loop with Jinja2?

With Jinja2, how can I do an iteration, like the following with django and not Jinja, for example:

{% 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: object 'builtin_function_or_method' is not iterated

Thanks for any advice.

+4
source share
1 answer

In Jinja2, functions and methods must be explicitly called .

 {% for key,value in location_map_india.items() %} {{value.name}} {% endfor %} 
+9
source

Source: https://habr.com/ru/post/1379245/


All Articles