1👍
Try using divisible_by to close <tr>
and open a new row. Example:
<tr>
{%for item in items%}
<td>{{data}}</td>
{%if forloop.counter|divisible_by:"9"%}
</tr>
<tr>
{%endif%}
{%endfor%}
</tr>
0👍
Assuming you don’t mind having those in separated tables (side by side in the same row), you are using it for days (max = 31, 4 columns with 9 rows), and you are using bootstrap (as in question tag) you could do something like that:
<div class='row'>
{%for item in items%}
{% if forloop.counter = "1" %} #I can't tell if this counter starts with 0 or one, be sure to make it the first interation number
<div class='col-lg-3'>
<table class="table table-bordered table-striped">
<tbody>
{% endif %}
{% if forloop.counter|divisible_by:"9" %}
</tbody>
</table>
</div>
<div class='col-lg-3'> # lg, sm, xl, choose your flavor
<table class="table table-bordered table-striped">
#add header here #
<tbody>
{% endif %}
<tr>
<td>{{ item.0 }}</td>
<td>{{ item.1 }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
- Got an unexpected keyword argument 'user'
- Saving huge amount of data (nearly 20 billion entries) in django postgresql
- Django Celery how to configure queues and see them in rabbitmq admin dashboard
- Error while declaring a list of lists in django
- Django admin – add more controls to the field
Source:stackexchange.com