title: Get different data from Django views in table
body: <p>I have CBV like this:</p>
  
  <pre><code>class MyTableViews(TemplateView):
      template_name = "table.html"
  
      def get_context_data(self, **kwargs):
          context = super().get_context_data(**kwargs)
          context['tables'] = Table.objects.all()
          return context
  </code></pre>
  
  <p>And I have tables like this:</p>
  
  <pre><code>&lt;table id="t_add_row" class="table"&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Header1&lt;/th&gt;
              &lt;th&gt;Header2&lt;/th&gt;
              &lt;th&gt;Header3&lt;/th&gt;
              &lt;th&gt;Edit&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          {% for item in tables %}
          &lt;tr&gt;
              &lt;td&gt;{{ item.id }}&lt;/td&gt;
              &lt;td&gt;{{ item.name }}&lt;/td&gt;
              &lt;td&gt;{{ item.address }}&lt;/td&gt;
              &lt;td&gt;
                  &lt;button type="button" class="edit" data-target="#rowEditModal"&gt;x&lt;/button&gt;
              &lt;/td&gt;
          &lt;/tr&gt;
          {% endfor %}
      &lt;/tbody&gt;
  &lt;/table&gt;
  </code></pre>
  
  <p>That table produce something like this:</p>
  
  <pre><code>|Header1|  Header2  |    Header3    | Edit  |
  |   1   |   Name1   |   Address1    |   x   |
  |   2   |   Name2   |   Address2    |   x   |
  |   3   |   Name3   |   Address3    |   x   |
  </code></pre>
  
  <p>And I have modal form in same templates, that targeted from above table for ID=#rowEditModal:</p>
  
  <pre><code>&lt;div class="modal-content" id="rowEditModal"&gt;
  
      {% for t in tables %}
      &lt;div class="modal-body"&gt;
          &lt;form&gt;
              &lt;div class="form-group"&gt;
                  &lt;label for="message-text" class="control-label"&gt;Header1:&lt;/label&gt;
                  &lt;input type="text" class="form-control" id="header1" value="{{ t.id }}"&gt;
              &lt;/div&gt;
              &lt;div class="form-group"&gt;
                  &lt;label for="message-text" class="control-label"&gt;Header2:&lt;/label&gt;
                  &lt;input type="text" class="form-control" id="header2" value="{{ t.name }}"&gt;
              &lt;/div&gt;
              &lt;div class="form-group"&gt;
                  &lt;label for="message-text" class="control-label"&gt;Header3:&lt;/label&gt;
                  &lt;input type="text" class="form-control" id="header3" value="{{ t.address }}"&gt;
              &lt;/div&gt;
          &lt;/form&gt;
      &lt;/div&gt;
  
      &lt;div class="modal-footer"&gt;
          &lt;button id="btn-updaterow" class="btn"&gt;Update&lt;/button&gt;
      &lt;/div&gt;
      {% endfor %}
  
  &lt;/div&gt;
  </code></pre>
  
  <p>But when I click Edit button (x) for <strong>each row</strong> then it display <strong>same data</strong> from 1st row only:</p>
  
  <pre><code>Header1:    1
  Header2:    Name1
  Header3:    Address1
  </code></pre>
  
  <p>How to get different data for each row?</p>