title: Getting the number of formset's id in Django
body: <p>In forms.py I have created a formset using formset_factory with extra=6</p>
  
  <pre><code>  class Associe(forms.Form):
        nom= forms.CharField(max_length=40)
    AssocieFormSet=formset_factory(Associe,extra=6)
  </code></pre>
  
  <p>in my page.html I wrote a loop to write my forms 6 times, but I nead the number in the id, I know Django will give <code>form-0-nom</code> for the first element, and <code>id_form-1-nom</code> for the seconde element and so on, and I know how to get the whole id of the element. </p>
  
  <p>But how can I get only the number of each element's id? </p>