A
A
AlexBoss2019-07-04 11:39:41
Django
AlexBoss, 2019-07-04 11:39:41

How to make 2 FOR loops in Dajngo2 templates?

How to make 2 FOR loops in templates? I do

{% for country in country_list %}
    <li>{{ country.grouper }}
    <ul>
        {% for city in country.list %}
          <li>{{ city.name }}: {{ city.population }}</li>
        {% endfor %}
    </ul>
    </li>
{% endfor %

I also throw one loop into another, but at the same time, the nested loop works only once and that's it ...

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question