formset forms can give false errors for add_forms
|Reported by:||Phil Davis <pmd@…>||Owned by:||jkocherhans|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
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 Changed 7 years ago by jkocherhans
- Needs documentation unset
- Needs tests unset
- Owner changed from adrian to jkocherhans
- Patch needs improvement unset
- Status changed from new to assigned
- Triage Stage changed from Unreviewed to Accepted