Using delete on modelformset doesn't remove form from set
|Reported by:||Michael Stevens <mstevens@…>||Owned by:||nobody|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
Description (last modified by kmtracey)
I'm using a ModelFormset created with lineformset_factory.
When I click delete on one of the records and save the formset, it
successfully removes the associated db record, but if I redisplay the
formset after the save, it's still showing the now removed form.
I've modified my code to recreate the formset from the db immediately
after the save:
if foo_formset.is_valid(): foo_formset.save() foo_formset = FooInlineFormset(instance=bar, prefix='foo')
and it does what I expect, but shouldn't it be in the right state
after the save?
Looking at the code I think the problem is that BaseModelFormSet
doesn't do anything with deleted forms after it deletes the underlying
model object - I'm expecting them to be removed from the formset as
I'm running a svn checkout of 1.1.