Django

Code

Ticket #3718 (closed: fixed)

Opened 2 years ago

Last modified 2 years ago

newforms.Form.clean should have access to field errors

Reported by: arve.knudsen@gmail.com Assigned to: adrian
Milestone: Component: Forms
Version: SVN Keywords:
Cc: gary.wilson@gmail.com Triage Stage: Design decision needed
Has patch: 1 Needs documentation: 0
Needs tests: 0 Patch needs improvement: 0

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

3718.diff (2.0 kB) - added by Gary Wilson <gary.wilson@gmail.com> on 05/14/07 23:09:57.
Save to self.__errors sooner in full_clean() so that the clean methods can access errors.

Change History

03/13/07 15:04:16 changed by SmileyChris

  • needs_better_patch changed.
  • stage changed from Unreviewed to Design decision needed.
  • needs_tests changed.
  • needs_docs changed.

05/14/07 10:01:39 changed by Gary Wilson <gary.wilson@gmail.com>

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

05/14/07 23:09:57 changed by Gary Wilson <gary.wilson@gmail.com>

  • attachment 3718.diff added.

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

05/14/07 23:10:23 changed by Gary Wilson <gary.wilson@gmail.com>

  • has_patch set to 1.

05/14/07 23:35:46 changed by Gary Wilson <gary.wilson@gmail.com>

  • cc set to gary.wilson@gmail.com.

05/26/07 04:02:17 changed by mtredinnick

  • status changed from new to closed.
  • resolution set to fixed.

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

05/26/07 04:47:48 changed by mtredinnick

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


Add/Change #3718 (newforms.Form.clean should have access to field errors)




Change Properties
Action