-1
<!-- 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 is a list, and I want to do something like:

for i in itemsOrganizedByStore[x] 

x being an index that would be declared in a for loop above. How can I use a number for x in Django?

Abdul Aziz Barkat
  • 19,475
  • 3
  • 20
  • 33
IcyCoder
  • 23
  • 3

1 Answers1

0

Perhaps you want get key and value in template

{% for key, value in your_dict.items %}

    {{ key }}-{{ value }}

{% endfor %}

Your question already at here.

Nguyễn Vũ Thiên
  • 761
  • 1
  • 9
  • 19