How to make sure the div have unique ids in a loop

I am looping thru a queryset with a div of textboxes and buttons. But im getting warning from the console that I am getting div with no unique ids. How do i deal with this?

Hello! I am not sure exactly what you need to achieve, but you can access forloop.counter for example in the template and create unique IDs from that for your divs.

Something like this:

{% for thing in stuff %}
     <div id="myDiv{{ forloop.counter }}">

    </div>

{% endfor %}

Now your divs would have IDs: “myDiv1”, “myDiv2” etc…

Thank you very much. I need this to display out the multiple details and send it back for update