Opened 18 years ago

Closed 18 years ago

Last modified 18 years ago

#3718 closed (fixed)

newforms.Form.clean should have access to field errors

Reported by: arve.knudsen@… Owned by: Adrian Holovaty
Component: Forms Version: dev
Severity: Keywords:
Cc: gary.wilson@… Triage Stage: Design decision needed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

I'm implementing a newforms.Form subclass in which I do form-wide validation in clean(). I'm missing the ability to check for errors detected during field validation though, I can only determine this by looking for missing entries in clean_data. Can you please expose field validation errors to the Form.clean hook?

Attachments (1)

3718.diff (2.0 KB ) - added by Gary Wilson <gary.wilson@…> 18 years ago.
Save to self.__errors sooner in full_clean() so that the clean methods can access errors.

Download all attachments as: .zip

Change History (7)

comment:1 by Chris Beaven, 18 years ago

Triage Stage: UnreviewedDesign decision needed

comment:2 by Gary Wilson <gary.wilson@…>, 18 years ago

And currently, looking at clean_data doesn't work in all cases since fields that pass validation but not the clean_XXX method still have their data in clean_data (the patch attached to #3896 would fix this problem though).

by Gary Wilson <gary.wilson@…>, 18 years ago

Attachment: 3718.diff added

Save to self.__errors sooner in full_clean() so that the clean methods can access errors.

comment:3 by Gary Wilson <gary.wilson@…>, 18 years ago

Has patch: set

comment:4 by Gary Wilson <gary.wilson@…>, 18 years ago

Cc: gary.wilson@… added

comment:5 by Malcolm Tredinnick, 18 years ago

Resolution: fixed
Status: newclosed

(In [5348]) Fixed #3718 -- Exposed form errors to cleaning methods as soon as they are
available. Patch from Gary Wilson.

comment:6 by Malcolm Tredinnick, 18 years ago

(In [5354]) Added a new form test that I forgot to commit in [5348]. Refs #3718.

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