【发布时间】:2021-04-08 01:28:23
【问题描述】:
<!-- we want the first to be visible -->
{% for j in listOfStoresUsed %}
<div class="col-sm-8" style="display: none; margin-left: 6em;" id = "store-{{j}}">
{% for i in itemsOrganizedByStore %}
<img width="200em" height="200em" src={{i.item.imgURL}}> <p>{{i.item.name}} Q:{{i.quantity}}</p><br>
{% endfor %}
{% endfor %}
itemsOrganizedByStore 是一个列表,我想做类似的事情:
for i in itemsOrganizedByStore[x]
x 是一个将在上面的 for 循环中声明的索引。如何在 Django 中为 x 使用数字?
【问题讨论】:
-
显示您对此模板的看法,您如何获得
listOfStoresUsed和itemsOrganizedByStore?
标签: django