[Django]-Django templates loops

10👍

You can zip the two lists in your view, then iterate through the resulting list in your template.

# views.py
ab = zip(a,b)

# template
{% for x,y in ab %}
    {{ x.a }},{{ x.c }}<br>
    {{ y.f }}
{% endfor %}

Leave a comment