Opened 15 years ago
Last modified 15 years ago
#11476 closed
Using delete on modelformset doesn't remove form from set — at Initial Version
Reported by: | Owned by: | nobody | |
---|---|---|---|
Component: | Forms | Version: | dev |
Severity: | Keywords: | ||
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
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
well.
I'm running a svn checkout of 1.1.