Django Formset Not Cleaning/Saving Properly <p>I'm using inlineformset_factory to create a formset. The parent object is a <em>featured set</em> and the child objects are <em>featured items</em>. I'm using the 'django-dynamic-formset' jQuery plugin on the front end to add/remove formset forms dynamically. </p> <p>While each form in the formset is getting submitted with the proper data as expected, cleaned_data only contains the form's id.</p> <p><strong>View:</strong></p> <pre><code>@login_required @csrf_protect def edit_featured_set(request, fset_id): ''' Edit a featured set and its items ''' c = {} c.update(csrf(request)) # get existing featured set for this id (if exists) if fset_id and int(fset_id) &gt; 0: try: fset_obj = Featureditemset.objects.get(id=fset_id) except Featureditemset.DoesNotExist: # bad or no id passed return HttpResponse('ObjectDoesNotExist') else: # get new featured set object fset_obj = Featureditemset(id = get_next_auto_inc(Featureditemset)) # define formset to work with featured items FeaturedItemFormSet = inlineformset_factory(Featureditemset, Featureditem, extra=1, form=FeatureditemEditForm) if request.method == 'POST': form = FeatureditemsetEditForm(request.POST, request.FILES, instance=fset_obj, prefix='set') if form.is_valid(): featured_item_formset = FeaturedItemFormSet(request.POST, request.FILES, instance=fset_obj, prefix='item') if featured_item_formset.is_valid(): # save form form.save() # save formset print 'Formset: %s' % str(featured_item_formset) print 'cleaned_data: %s' % featured_item_formset.cleaned_data featured_item_formset.save() return HttpResponse('valid') else: form = FeatureditemsetEditForm(instance=fset_obj, prefix='set') featured_item_formset = FeaturedItemFormSet(instance=fset_obj, prefix='item') c['form'] = form c['formset'] = featured_item_formset return render_to_response('admin/edit_featured.html', c, context_instance = RequestContext(request)) </code></pre> <p><strong>Forms:</strong></p> <pre><code>class FeatureditemEditForm(ModelForm): class Meta: model = Featureditem fields = ('id','img', 'name', 'folio') class FeatureditemsetEditForm(ModelForm): class Meta: model = Featureditemset fields = ('name', 'application') </code></pre> <p><strong>Models:</strong></p> <pre><code>class Featureditemset(models.Model): id = models.BigIntegerField(primary_key=True, db_column='FEATUREDITEMSET_ID') application = models.ForeignKey(Application, null=True, db_column='FEATUREDITEMSET_APPLICATION_ID', blank=True) htmlcontent = models.TextField(db_column='FEATUREDITEMSET_HTMLCONTENT', blank=True) modified = models.DateTimeField(db_column='FEATUREDITEMSET_MODIFIED', auto_now=True) viewer = models.ForeignKey(Viewer, null=True, db_column='FEATUREDITEMSET_VIEWER', blank=True) name = models.CharField(max_length=192, db_column='FEATUREDITEMSET_NAME', blank=True) class Meta: db_table = u'featureditemset' def __unicode__(self): return str(self.name) class Featureditem(models.Model): id = models.BigIntegerField(db_column='FEATURED_ITEM_ID', primary_key=True) img = models.FileField(upload_to='featured', db_column='FEATURED_ITEM_IMG_URL', blank=True) alt_title = models.CharField(max_length=768, db_column='FEATURED_ITEM_ALT_TITLE', blank=True) modified = models.DateTimeField(db_column='FEATURED_ITEM_MODIFIED', auto_now=True) folio = models.ForeignKey(Folio, db_column='FEATURED_ITEM_FOLIO_ID', blank=False) app = models.ForeignKey(Application, null=True, db_column='FEATURED_ITEM_APP_ID', blank=True) name = models.CharField(max_length=192, db_column='FEATURED_ITEM_NAME', blank=True) featureditemset = models.ForeignKey(Featureditemset, null=True, db_column='FEATUREDITEM_FEATUREDITEMSET_ID', blank=True) def __unicode__(self): return self.name class Meta: db_table = u'featureditem' </code></pre> <p><strong>Output to console:</strong></p> <pre><code>Formset: &lt;input type="hidden" name="item-TOTAL_FORMS" value="1" id="id_item-TOTAL_FORMS" /&gt;&lt;input type="hidden" name="item-INITIAL_FORMS" value="1" id="id_item-INITIAL_FORMS" /&gt;&lt;input type="hidden" name="item-MAX_NUM_FORMS" id="id_item-MAX_NUM_FORMS" /&gt; &lt;tr&gt;&lt;th&gt;&lt;label for="id_item-0-id"&gt;Id:&lt;/label&gt;&lt;/th&gt;&lt;td&gt;&lt;input type="text" name="item-0-id" value="5" id="id_item-0-id" /&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt;&lt;th&gt;&lt;label for="id_item-0-img"&gt;Featured Image:&lt;/label&gt;&lt;/th&gt;&lt;td&gt;&lt;input type="file" name="item-0-img" id="id_item-0-img" /&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt;&lt;th&gt;&lt;label for="id_item-0-name"&gt;Name:&lt;/label&gt;&lt;/th&gt;&lt;td&gt;&lt;input id="id_item-0-name" type="text" name="item-0-name" value="item1" maxlength="192" /&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt;&lt;th&gt;&lt;label for="id_item-0-folio"&gt;Folio:&lt;/label&gt;&lt;/th&gt;&lt;td&gt;&lt;select name="item-0-folio" id="id_item-0-folio"&gt; &lt;option value="1" selected="selected"&gt;0000054220110900000025&lt;/option&gt; &lt;option value="2"&gt;com.maned.kwmultitest&lt;/option&gt; &lt;/select&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt;&lt;th&gt;&lt;label for="id_item-0-DELETE"&gt;Delete:&lt;/label&gt;&lt;/th&gt;&lt;td&gt;&lt;input type="checkbox" name="item-0-DELETE" id="id_item-0-DELETE" /&gt;&lt;input type="hidden" name="item-0-featureditemset" id="id_item-0-featureditemset" /&gt;&lt;/td&gt;&lt;/tr&gt; cleaned_data: [{'id': 5}] </code></pre>