title: how to test a Django formset submission
body: <p>I'm either missing something very simple (and my Google-Fu is lacking), or I'm way off track.  You make the call!</p>
  
  <p>I'd like to write a test to exercise POSTing a formset to a view.</p>
  
  <pre><code># get the modelformset from the view
  response = self.client.get("/myview")
  formset = response.context['formset']
  
  # change the values in the underlying form
  for form in enumerate(formset):
      form.instance['something'] = i
  
  # how do I post the formset back to myview?  this does NOT work...
  response = self.client.post("/myview", formset, follow=True)
  
  
  AttributeError: 'MyFormSet' object has no attribute 'items'
  </code></pre>
  
  <p>The error makes complete sense, because I need to pass a dictionary as the second argument, not a Formset.  I'm hoping that there's some method on Formset that will give me the appropriate dictionary (with the management form info), but I can't find it for the life of me.</p>
  
  <p>UPDATE:</p>
  
  <p>I got it working by doing this:</p>
  
  <pre><code>    data = {}
      for field in formset.management_form:
          data["-".join((formset.management_form.prefix, field.name))] = field.value()
      for form in formset:
          for field in form:
              data["-".join((form.prefix, field.name))] = field.value()
  
      self.client.post(reverse("/myview"), data, follow=True)
  </code></pre>
  
  <p>but I'm still wondering if there's a built-in formset method to do this, and I just can't see it....</p>