title: Django Formsets: ManagementForm data is missing or has been tampered with
body: <p>I am using inline formsets. I have a main form <strong>application</strong>. Then 2 formsets <strong>employ</strong> and <strong>qual</strong>.</p>
  
  <p>When I run my view. I get an error saying <strong>ManagementForm data is missing or has been tampered with</strong></p>
  
  <p>Here is my view</p>
  
  <pre><code>@login_required
  def apply(request):
      if request.POST:
          data = {'form-TOTAL_FORMS': u'1','form-INITIAL_FORMS': u'0','form-MAX_NUM_FORMS': u''}
          form = ApplicationForm(request.POST)
          employ_formset = EmploymentFormSet(data)
          qual_formset = QualificationFormSet(data)
          if form.is_valid():
              application = form.save(commit=False)
              employ_formset = EmploymentFormSet(request.POST, instance=application)
              qual_formset = QualificationFormSet(request.POST, instance=application)
              if employ_formset.is_valid() and qual_formset.is_valid():
                  application.save()
                  employ_formset.save()
                  qual_formset.save()
              return HttpResponse('This Worked!!!!!!!!')
      else:
          form = ApplicationForm()
          employ_formset = EmploymentFormSet(instance=Application())
          qual_formset = QualificationFormSet(instance=Application())
      return render_to_response('apply.html', {'form':form, 'employ_formset':employ_formset, 'qual_formse
  </code></pre>
  
  <p>And here is my template. I realise I could simply the template. But I want the inline formsets to appear horizontally like the Django Admin.</p>
  
  <pre><code>{% extends "base.html" %}
  {% load i18n %}
  
  {% block content %}
  &lt;form action="." method="post" class="application_form"&gt;
      {% csrf_token %}
      &lt;!-- PERSONAL --&gt;
      &lt;h3&gt;Applicant Details&lt;/h3&gt;&lt;br /&gt;
      &lt;table&gt;
        &lt;tr&gt;
          &lt;td&gt;&lt;label for="id_title"&gt;Title:&lt;/label&gt;&lt;/td&gt;
          &lt;td&gt;{{ form.title }}&lt;small&gt;{{ form.title.errors }}&lt;/small&gt;&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
          &lt;td&gt;&lt;label for="id_firstname"&gt;Firstname:&lt;/label&gt;&lt;/td&gt;
          &lt;td&gt;{{ form.firstname }}&lt;small&gt;{{ form.firstname.errors }}&lt;/small&gt;&lt;/td&gt;
          &lt;td&gt;&lt;label for="id_surname"&gt;Surname:&lt;/label&gt;&lt;/td&gt;
          &lt;td&gt;{{ form.surname }}&lt;small&gt;{{ form.surname.errors }}&lt;/small&gt;&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
          &lt;td&gt;&lt;label for="id_address"&gt;Address:&lt;/label&gt;&lt;/td&gt;
          &lt;td&gt;{{ form.address }}&lt;small&gt;{{ form.address.errors }}&lt;/small&gt;&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
          &lt;td&gt;&lt;label for="id_email"&gt;Email:&lt;/label&gt;&lt;/td&gt;
          &lt;td&gt;{{ form.email }}&lt;small&gt;{{ form.email.errors }}&lt;/small&gt;&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
          &lt;td&gt;&lt;label for="id_mobilephone"&gt;Mobile Phone:&lt;/label&gt;&lt;/td&gt;
          &lt;td&gt;{{ form.mobilephone }}&lt;small&gt;{{ form.mobilephone.errors }}&lt;/small&gt;&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
          &lt;td&gt;&lt;label for="id_homephone"&gt;Home Phone:&lt;/label&gt;&lt;/td&gt;
          &lt;td&gt;{{ form.homephone }}&lt;small&gt;{{ form.homephone.errors }}&lt;/small&gt;&lt;/td&gt;
        &lt;/tr&gt;
      &lt;/table&gt;
  
      &lt;!-- EDUCATION --&gt;
      &lt;br /&gt;
      &lt;h3&gt;Employment Details&lt;/h3&gt;&lt;br /&gt;
      {{ employ_formset.management_form }}
      {{ employ_formset.non_form_errors.as_ul }}
      &lt;table id="formset" class="form"&gt;
      {% for form in employ_formset.forms %}
        {% if forloop.first %}
        &lt;thead&gt;
          &lt;tr&gt;
          {% for field in form.visible_fields %}
            &lt;th&gt;{{ field.label|capfirst }}&lt;/th&gt;
          {% endfor %}
          &lt;/tr&gt;
        &lt;/thead&gt;
        {% endif %}
        &lt;tr class="{% cycle row1,row2 %}"&gt;
        {% for field in form.visible_fields %}
      &lt;td&gt;
      {# Include the hidden fields in the form #}
      {% if forloop.first %}
        {% for hidden in form.hidden_fields %}
          {{ hidden }}
        {% endfor %}
      {% endif %}
      {{ field.errors.as_ul }}
      {{ field }}
      &lt;/td&gt;
    {% endfor %}
    &lt;/tr&gt;
  {% endfor %}
  &lt;/table&gt;
  </code></pre>