Opened 9 years ago

Closed 9 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 9 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

comment:2 Changed 9 years ago by jkocherhans

  • Resolution set to fixed
  • Status changed from assigned to 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.

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