Opened 15 years ago
Closed 15 years ago
#11476 closed (wontfix)
Using delete on modelformset doesn't remove form from set — at Version 1
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 (last modified by )
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.
Change History (1)
comment:1 by , 15 years ago
Description: | modified (diff) |
---|---|
Resolution: | → wontfix |
Status: | new → closed |
Fixed formatting. Please use preview, you need three brackets, not two, to embed code.
This was answered on the mailing list as a problem with your expectations, not a bug in the code: http://groups.google.com/group/django-users/browse_thread/thread/97885473cb5b4ffd/ so I am not sure why you opened a ticket on it. If you disagree it would have been better to continue the conversation on the list. You have provided no new information/support for your viewpoint in this ticket so the answer here is the same.
Re-displaying a form after successfully processing it is not an expected pattern, nor is it good design from a usability standpoint. Doing work to fix up the form data to reflect a delete is thus a waste of time for the normal case and enabling bad design. I don't believe we should do this.