title: How to populate database data into multiple modal windows based on ID in Django?
body: <p>I want to fetch the data of database to the modal window based on their IDs.</p>
  <p><code>User Storage</code> is the model name contains multiple IDs based on users.</p>
  <p>for example,</p>
  <p>ID -1 should have data A.
  For ID -2, there should be data B and so on till it iterate IDs of specific user.</p>
  <p>In views.py file,</p>
  <pre><code>@csrf_exempt
  def profile(request,module_id):
      if request.user.is_authenticated:
          user_storage_main = user_storage.objects.filter(custom_user=module_id)
          user_storage = user_storage.objects.get(id=module_id)
      return render(request, 'profile.html',{&quot;user_storage_main&quot;:user_storage_main,&quot;user_storage&quot;:user_storage})
  </code></pre>
  <p>and in HTML page,</p>
  <pre><code>&lt;table&gt;
      {% for objects in user_storage_main %}
      &lt;tr&gt;
          &lt;td&gt;&lt;li class=&quot;dsi&quot;&gt;&lt;a title=&quot;&quot; href=&quot;#{{ forloop.counter }}&quot;&gt;&lt;i class=&quot;fa fa-edit&quot;&gt;&lt;/i&gt;&lt;/a&gt;&lt;/li&gt;&lt;/td&gt;
          &lt;td&gt;&lt;a href=&quot;#&quot;&gt;&lt;i class=&quot;fa fa-trash&quot;&gt;&lt;/i&gt;&lt;/a&gt;&lt;/td&gt;
          &lt;td&gt;{{objects.store_name}} , {{objects.store_category}}, {{objects.store_start_date}}&lt;/td&gt;
      &lt;/tr&gt;
      {% endfor %}
  &lt;/table&gt;
  
  &lt;!-- MODAL WINDOWS STARTED HERE --&gt;
  &lt;div class=&quot;dsi_popup&quot; id=&quot;{{ forloop.counter }}&quot;&gt;
      &lt;div class=&quot;new-popup&quot;&gt;
          &lt;span class=&quot;close-popup&quot;&gt;&lt;i class=&quot;la la-close&quot;&gt;&lt;/i&gt;&lt;/span&gt;
          &lt;h3&gt;Heading&lt;/h3&gt;&lt;br&gt;&lt;br&gt;
          &lt;form id=&quot;www_id&quot; method=&quot;post&quot;&gt;
              &lt;div class=&quot;row&quot;&gt;
                  &lt;div class=&quot;col-lg-10&quot;&gt;
                      &lt;span class=&quot;pf-title&quot;&gt;Update Store Name&lt;/span&gt;                                         
                      &lt;div class=&quot;pf-field&quot;&gt;
                          &lt;input id=&quot;sn&quot; type=&quot;text&quot; value=&quot;{{user_storage.store_name}}&quot; /&gt;
                      &lt;/div&gt;
                  &lt;/div&gt;
                  &lt;div class=&quot;col-lg-4&quot;&gt;
                      &lt;span class=&quot;pf-title&quot;&gt;Update Store Category&lt;/span&gt;
                      &lt;div class=&quot;pf-field&quot;&gt;
                          &lt;input id=&quot;sc&quot; type=&quot;text&quot; value=&quot;{{user_storage.category}}&quot; /&gt;
                      &lt;/div&gt;
                  &lt;/div&gt;
                  &lt;div class=&quot;col-lg-4&quot;&gt;
                      &lt;span class=&quot;pf-title&quot;&gt;Update Start Date&lt;/span&gt;
                      &lt;div class=&quot;pf-field&quot;&gt;
                          &lt;input id=&quot;sd&quot; type=&quot;date&quot; name=&quot;sd&quot;&gt;
                      &lt;/div&gt;
                  &lt;/div&gt;
                  &lt;div class=&quot;col-lg-12&quot;&gt;
                      &lt;button type=&quot;submit&quot;&gt;Update&lt;/button&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
          &lt;/form&gt;
      &lt;/div&gt;
  &lt;/div&gt;&lt;!-- MODAL WINDOW END HERE --&gt;
  </code></pre>
  <p><strong>EXPECTED OUTPUT :</strong></p>
  <p>Currently in my database, there are 3 user storages of user with <code>user_id - 1</code>.</p>
  <p>So in table, I want to show all 3 user storage details in tabular format and if user will click on any of it's edit button then one modal with will open based on id i.e.,(#1,#2,#3), it would contains data of that <code>user_storage</code> ID.</p>
  <p><strong>OBSERVED OUTPUT :</strong></p>
  <p>In all the 3 modal windows, it is showing only the data of ID- 1 (ID - 1 because it is user ID is 1)</p>