Opened 12 years ago
Closed 12 years ago
#18906 closed Bug (fixed)
BaseModelFormSet.validate_unique should ignore forms marked for deletion
Reported by: | Owned by: | nobody | |
---|---|---|---|
Component: | Forms | Version: | 1.4 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Accepted | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
is_valid() returns false for a formset where uniquness is violated even if one of the forms where the violation occurs has DELETE set to true in cleaned data
so maybe line 521 in django/forms/models.py which is currently
if not hasattr(form, "cleaned_data"):
continue
should read something like, so it will ignore forms that are getting deleted anyway
if not hasattr(form, "cleaned_data") or form.cleaned_data.get('DELETE', True):
continue
unless of course I have completely missed the point
Cheers
Charlie
Attachments (1)
Change History (4)
comment:1 by , 12 years ago
Triage Stage: | Unreviewed → Accepted |
---|
comment:2 by , 12 years ago
Has patch: | set |
---|
comment:3 by , 12 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
I was able to reproduce the issue in a test.