title: Django Delete Button Action for ModelFormset
body: <p>I've got a modelformset which is shown in below:</p>
  
  <p><strong>views.py</strong></p>
  
  <pre><code>def manage_authors(request):
      AuthorFormSet = modelformset_factory(Author, fields=('name', 'title', 'birth_date'))
      if request.method == 'POST':
          if "del_btn" in request.POST:
              query = Author.objects.get(...).delete()
              formset = AuthorFormSet(request.POST, request.FILES)
              if formset.is_valid():
                  formset.save()
                  formset = AuthorFormSet(queryset=Author.objects.all())
                  print "yes"
          else:
              formset = AuthorFormSet(request.POST, request.FILES)
              if formset.is_valid():
                  formset.save()
                  formset = AuthorFormSet(queryset=Author.objects.all())
      else:
          formset = AuthorFormSet(queryset=Author.objects.all())
      return render(request, "manage_authors.html", {"formset": AuthorFormSet, })
  </code></pre>
  
  <p><strong>manage_authors.html</strong></p>
  
  <pre><code>&lt;form method="post" action="/manage_authors.html"&gt;{% csrf_token %}
  {{ formset.management_form }}
  {% for form in formset %}
      {{ form.id }}
      &lt;ul&gt;
          {{ form.name }} {{ form.title }} {{ form.birth_date }}
          &lt;input type="submit" name="del_btn" value="Delete"/&gt;
      &lt;/ul&gt;
  {% endfor %}
  &lt;input type='submit' name="edit_btn" value='Edit / Add'/&gt;
  </code></pre>
  
  <p></p>
  
  <p><a href="https://i.stack.imgur.com/9V8i0.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/9V8i0.png" alt="enter image description here"></a></p>
  
  <p>What query I can define so that the Delete button could work?</p>
  
  <p>Now, I got problem with knowing which row must be deleted.</p>
  
  <p>Thanks in advance</p>