title: Django: Aquiring form id from formset
body: <p>I am not sure if title describes what i want accurately. What i want is to achieve something like that: <a href="https://stackoverflow.com/questions/1405587/django-add-remove-form-without-multiple-submit/1406819#1406819">Django add / remove form without multiple submit</a>.</p>
  
  <p>But i have not list of items i have formset and forms. The form of this formset does contain information i could use for creating link like that {% url 'item_edit' item.id %}. The problem is that it is a value of an hidden field. Here (<a href="http://docs.djangoproject.com/en/dev/topics/forms/#looping-over-the-form-s-fields" rel="nofollow noreferrer">http://docs.djangoproject.com/en/dev/topics/forms/#looping-over-the-form-s-fields</a>) you have a list of options how to use fields of a form in a template, but none of them is {{ field.value }}. If i tried that, then it just failed silently.</p>
  
  <p>Anyway. to the code. What i have in template is:</p>
  
  <pre><code>    &lt;form enctype="multipart/form-data" method="post" action="/list/edit/{{ list.id }}/"&gt;
          &lt;table&gt;
          {{ form.as_table }}
          {{ formset.management_form }}
          {% for form in formset.forms %}
              {% if forloop.first %}
                  &lt;tr&gt;
                  {% for field in form.visible_fields %}
                      &lt;td&gt;{{ field.label }}&lt;/td&gt;
                  {% endfor %}
                  &lt;/tr&gt;
              {% endif %}
              &lt;tr&gt;
                  {% for field in form.visible_fields %}
                      {% if not forloop.last %}
                          &lt;td&gt;{{ field }}&lt;/td&gt;
                      {% else %}
                          &lt;td&gt;{{ field }}
                      {% endif %}
                  {% endfor %}
                  {% for field in form.hidden_fields %}
                      {% if not forloop.last %}
                          {{ field }}
                      {% else %}
                          {{ field }}&lt;/td&gt;
                      {% endif %}
                  {% endfor %}
              &lt;/tr&gt;
          {% endfor %}
          &lt;tr&gt;&lt;td&gt;&lt;input type="submit" value="Submit"&gt;&lt;/td&gt;&lt;td colspan="4"&gt;&amp;nbsp;&lt;/td&gt;&lt;/tr&gt;
          &lt;/table&gt;
      &lt;/form&gt;
  </code></pre>
  
  <p>And this gives me inline form rows like this:</p>
  
  <pre><code>&lt;tr&gt;
      &lt;td&gt;&lt;input type="text" maxlength="200" value="test2" name="shoppinglistitem_set-0-itemname" id="id_shoppinglistitem_set-0-itemname"/&gt;&lt;/td&gt;
      &lt;td&gt;&lt;input type="text" maxlength="200" value="http://www.xxx.ee" name="shoppinglistitem_set-0-link" id="id_shoppinglistitem_set-0-link"/&gt;&lt;/td&gt;
      &lt;td&gt;&lt;input type="text" maxlength="100" value="eepöäsdöäfsdfd" name="shoppinglistitem_set-0-store" id="id_shoppinglistitem_set-0-store"/&gt;&lt;/td&gt;
      &lt;td&gt;&lt;input type="text" id="id_shoppinglistitem_set-0-price" value="22134" name="shoppinglistitem_set-0-price"/&gt;&lt;/td&gt;
      &lt;td&gt;&lt;input type="checkbox" id="id_shoppinglistitem_set-0-DELETE" name="shoppinglistitem_set-0-DELETE"/&gt;&lt;input type="hidden" id="id_shoppinglistitem_set-0-list" value="1" name="shoppinglistitem_set-0-list"/&gt;&lt;input type="hidden" id="id_shoppinglistitem_set-0-listitem_ptr" value="5" name="shoppinglistitem_set-0-listitem_ptr"/&gt;&lt;/td&gt;
  &lt;/tr&gt;
  </code></pre>
  
  <p>and i am looking for some way to add link like this </p>
  
  <pre><code>&lt;a href={% url 'remove_list_item' item.id %}&gt;REmove&lt;/a&gt; 
  </code></pre>
  
  <p>or just </p>
  
  <pre><code>&lt;a href="http://localhost/list/removeitem/{{ id }}"&gt;REmove&lt;/a&gt;
  </code></pre>
  
  <p>Urlconf for this view is:</p>
  
  <pre><code>url(r'^removeitem/(?P&lt;lisitem_id&gt;\d+)/$', 'remove_list_item', name='remove_list_item')
  </code></pre>
  
  <p>So is there some easy way to get that id of the item(object) from the form? Do i have to create some kind of widget for that remove link instead?</p>
  
  <p>Alan.</p>