Opened 17 years ago
Closed 17 years ago
#5388 closed (fixed)
[newforms-admin] - validation is broken for sites with more than one inline formsets
Reported by: | Owned by: | jkocherhans | |
---|---|---|---|
Component: | Forms | Version: | newforms-admin |
Severity: | Keywords: | newforms, admin, inlines | |
Cc: | Triage Stage: | Ready for checkin | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
Validation of inline formsets is done with this code:
def all_valid(formsets): """Returns true if every formset in formsets is valid.""" valid = True for formset in formsets: if not formset.is_valid(): return False
But method formset.is_valid has side-effect - it calls formset.clean_all and method clean_all resets all unused inline formset. But if first formset is invalid, forms in the second formset aren't reset.
This code works (attached patch changes it):
def all_valid(formsets): """Returns true if every formset in formsets is valid.""" valid = True for formset in formsets: if not formset.is_valid(): valid = False return valid
Attachments (1)
Change History (4)
by , 17 years ago
Attachment: | formsets-validation.diff added |
---|
comment:1 by , 17 years ago
Triage Stage: | Unreviewed → Ready for checkin |
---|
comment:2 by , 17 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:3 by , 17 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
Note:
See TracTickets
for help on using tickets.
(In [6104]) newforms-admin: Fixed #5388. Validation broken for models with > 1 inline formset.