Opened 11 years ago

Closed 11 years ago

#4661 closed (fixed)

formset forms can give false errors for add_forms

Reported by: Phil Davis <pmd@…> 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: UI/UX:


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 ( 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 11 years ago by jkocherhans

Owner: changed from Adrian Holovaty to jkocherhans
Status: newassigned
Triage Stage: UnreviewedAccepted

comment:2 Changed 11 years ago by jkocherhans

Resolution: fixed
Status: assignedclosed

(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.

Note: See TracTickets for help on using tickets.
Back to Top