title: Dynamically added forms not saving to inlineformset_factory Django
body: <p>I have been following a variety of tutorials for a while and trying to understand/put them all together to achieve the ability for my user to dynamically add instances to a child within an inlineformset_factory.</p>
  
  <p>My project is a simple employee/shifts set up. My parent model is a <strong>ManagerChecklist</strong> model that the manager would complete at the end of the day. The child model is an <strong>EmployeeShift</strong> model that contains information of each of the employees that worked on that shift and what hours they did. I would like my manager to be able to dynamically add employees to his "manager checklist" form.</p>
  
  <p>views.py</p>
  
  <pre><code>def update_manager_checklist(request, date):
      template_name = 'shifts/checklists/manager_checklist_update.html'
      instance = get_object_or_404(ManagerChecklist, shift__shift_date=date)
      checklist = inlineformset_factory(ManagerChecklist, EmployeeShift,
                                        fields=('employee', 'start_time',
                                                'end_time', 'total_hours_worked',
                                              ),
                                        extra=0, max_num=None)
      if request.method == 'POST':
          formset = checklist(request.POST, instance=instance)
          if formset.is_valid():
              formset.save()
              return redirect('shifts:shift_list')
  
      formset = checklist(instance=instance)
      return render(request, template_name, {
          'formset': formset,
      })
  </code></pre>
  
  <p>html:</p>
  
  <pre><code>{{ formset.management_form }}
  &lt;div id="form_set"&gt;
      {% for form in formset %}
          &lt;table class='no_error'&gt;
              {{ form.as_table }}
          &lt;/table&gt;
      {% endfor %}
  &lt;/div&gt;
  &lt;input type="button" value="Add More" id="add_more"&gt;
  &lt;div id="empty_form" style="display:none"&gt;
      &lt;table class='no_error'&gt;
          {{ formset.empty_form.as_table }}
      &lt;/table&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>javascript:</p>
  
  <pre><code>&lt;script&gt;
  $('#add_more').click(function() {
      var form_idx = $('#id_form-TOTAL_FORMS').val();
      $('#form_set').append($('#empty_form').html().replace(/__prefix__/g, form_idx));
      $('#id_form-TOTAL_FORMS').val(parseInt(form_idx) + 1);
  });&lt;/script&gt;
  </code></pre>
  
  <p>The javascript is working fine to add the forms visually to the page - however they are not being validated or added or obviously sent at all to the views.py. If I update the existing forms or create an extra employeeshift using extra=1 instead of extra=0 then it is properly validating and adding that.</p>
  
  <p>I am assuming I need to add some code to my views.py so that it will pick up the <code>formset.empty_form</code> that is being dynamically added? Or maybe there is a problem with the information javascript is sending to django?</p>
  
  <p>Thanks in advance for any help.</p>