Opened 17 years ago
Closed 17 years ago
#4661 closed (fixed)
formset forms can give false errors for add_forms
Reported by: | Owned by: | jkocherhans | |
---|---|---|---|
Component: | Forms | Version: | newforms-admin |
Severity: | Keywords: | formset | |
Cc: | Triage Stage: | Accepted | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
If you create a simple editinline example and view it in admin and cause an error in one of the master fields, all of the empty detail forms also get an error against all their required fields.
This is because the logic in BaseFormSet.full_clean which resets empty 'add' forms never gets called as the higher level (options.py line 689 at rev 5585) code does:
if form.is_valid() and all_valid(inline_formsets): return self.save_change(request, model, form, inline_formsets)
An obvious fix would be to ensure that all_valid is always called regardless of the validity of the main form in order to trigger the empty form reset but that may cause problems if clean methods in the formset forms assume the main form is valid.
Change History (2)
comment:1 by , 17 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
Triage Stage: | Unreviewed → Accepted |
comment:2 by , 17 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
(In [5589]) newforms-admin: Fixed #4661 - formset forms can give false errors for add_forms. Resetting the forms is still hackish, but this works for now.