Opened 10 years ago

Closed 10 years ago

Last modified 10 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: master
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: UI/UX:

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@…> 10 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 Changed 10 years ago by Chris Beaven

Triage Stage: UnreviewedDesign decision needed

comment:2 Changed 10 years ago by Gary Wilson <gary.wilson@…>

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

Changed 10 years ago by Gary Wilson <gary.wilson@…>

Attachment: 3718.diff added

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

comment:3 Changed 10 years ago by Gary Wilson <gary.wilson@…>

Has patch: set

comment:4 Changed 10 years ago by Gary Wilson <gary.wilson@…>

Cc: gary.wilson@… added

comment:5 Changed 10 years ago by Malcolm Tredinnick

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 Changed 10 years ago by Malcolm Tredinnick

(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