V
V
Villian_Os2020-10-22 07:07:47
Django
Villian_Os, 2020-10-22 07:07:47

How to make two loops at the same time in a django template?

There is a cycle in the template

{% for report in reports %}
{{ report }}
{% endfor %}

But also I want to pass a list and output it element by element with each {{ report }}
I can't figure out how to do this, if I already have a loop, how can I implement this?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Gornostaev, 2020-10-22
@Villian_Os

{% for report in reports %}
    {% for line in report %}
        {{ line }}
    {% endofr %}
{% endfor %}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question