Opened 8 years ago

Closed 8 years ago

#5175 closed (invalid)

Formsets - formset.required_forms not implemented?

Reported by: Simon Litchfield <simon@…> Owned by: adrian
Component: Forms Version: newforms-admin
Severity: Keywords:
Cc: Triage Stage: Design decision needed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

Setting formset.required_forms seems to make no difference to formset validation.

I guess we need something similar to ErrorDict to handle formset errors?

Since form errors will most likely be accessed directly, I tend to think the default formset.errors should be reserved for formset errors instead of individual formset errors, or at least a combination of the two.

Then formset.form_errors could be used to return the list of individual forms' errors.

Attachments (5)

formsets-required_forms-5897.diff (2.5 KB) - added by Simon Litchfield <simon@…> 8 years ago.
Adds formset.formset_errors ErrorList if number of required_forms is not met
formsets-required_forms-5897b.diff (2.8 KB) - added by Simon Litchfield <simon@…> 8 years ago.
(ignore previous) Adds formset.formset_errors ErrorList if number of required_forms is not met
formsets-required_forms-5897c.diff (2.8 KB) - added by Simon Litchfield <simon@…> 8 years ago.
(ignore previous!!!) Adds formset.formset_errors ErrorList if number of required_forms is not met
formsets-required_forms2-5897.diff (2.8 KB) - added by Simon Litchfield <simon@…> 8 years ago.
USE THIS ONE
required_forms-formsets.diff (2.8 KB) - added by Simon Litchfield <simon@…> 8 years ago.
USE THIS ONE

Download all attachments as: .zip

Change History (7)

Changed 8 years ago by Simon Litchfield <simon@…>

Adds formset.formset_errors ErrorList if number of required_forms is not met

Changed 8 years ago by Simon Litchfield <simon@…>

(ignore previous) Adds formset.formset_errors ErrorList if number of required_forms is not met

Changed 8 years ago by Simon Litchfield <simon@…>

(ignore previous!!!) Adds formset.formset_errors ErrorList if number of required_forms is not met

Changed 8 years ago by Simon Litchfield <simon@…>

USE THIS ONE

Changed 8 years ago by Simon Litchfield <simon@…>

USE THIS ONE

comment:1 Changed 8 years ago by Simon Litchfield <simon@…>

  • Has patch set
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Design decision needed

Excuse the mess, the diff previewer doesn't seem to like my diffs for some reason.

This patch covers 5173, 5174, 5175 (again, excuse, one snag encountered after another).

A couple of other nasty little bugs fixed too.

comment:2 Changed 8 years ago by jkocherhans

  • Resolution set to invalid
  • Status changed from new to closed

formset.required_forms is not meant to be a public attribute. Setting it would have unpredictable results. That said, FormSets still need a hook to do validation on *all* forms in the set. I imagine that's what you want here. I've opened up #5353 to track that. Something like ErrorDict would probably be useful, but that discussion needs to occur on django-dev. Not enough people will see it here. If you have a design in mind, please propose it there. Otherwise, I'll keep it in mind when I get around to implementing #5353.

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