How can I loop through items in django template on the following way
{% for brand in categories%}
<div class="brand-col">
<figure class="brand-wrapper">
<img src="{{brand.product_feature_image.image.url}}" alt="Brand" width="410" height="186" /> (item1)
</figure>
<img src="{{brand.product_feature_image.image.url}}" alt="Brand" width="410" height="186" /> (item2)
</figure>
</div>
{% endfor %}
<div class="brand-col">
<figure class="brand-wrapper">
<img src="{{brand.product_feature_image.image.url}}" alt="Brand" width="410" height="186" /> (item3)
</figure>
<img src="{{brand.product_feature_image.image.url}}" alt="Brand" width="410" height="186" /> (item4)
</figure>
</div>
<div class="brand-col">
<figure class="brand-wrapper">
<img src="{{brand.product_feature_image.image.url}}" alt="Brand" width="410" height="186" /> (item5)
</figure>
<img src="{{brand.product_feature_image.image.url}}" alt="Brand" width="410" height="186" /> (item6)
</figure>
</div>
Reference: (item number inside bracket is just for reference) Here, first I want to loop 1 and loop 2 on figure tag and again I want to loop entire div and loop 3 and loop 4 inside the div on figure tag.
I tried to do with cycle, but no luck. Any help will be highly appreciated.