0
<thead>
<th> username </th>
<th>place</th>
</thead>

{% for i, j in user_group1, user_group2 %}
<tbody>
    {% if i %}
    <td>{{ i.username }}</td>
    <td>{{ i.place }}</td>
    {% else %}
    <td>{{ j.username }}</td>
    <td>{{ j.place }}</td>
    {% endif %}
</tbody>
{% endfor %}

I want to use two for loops in a sinle table body. First i need to start the first one and after that i need to start the next one. how can i do this

mohammed wazeem
  • 1,310
  • 1
  • 10
  • 26

1 Answers1

1

If you're using Jinja2, you can join the two lists into one with the + operator:

{% for i in user_group1|list + user_group2|list %}
<tbody>
    <td>{{ i.username }}</td>
    <td>{{ i.place }}</td>
</tbody>
{% endfor %}
blhsing
  • 91,368
  • 6
  • 71
  • 106