On Wed, Mar 25, 2015 at 9:37 AM, Thomas Güttler <h...@tbz-pariv.de> wrote:
> Up to now the validation/cleaning of a attribute can not access the
> value of an other attribute.
>
> The work around is to override the clean() method of the form/model.
>
> A team mate and I talked about it, and we asked ourself, if
> a two phase cleaning would help here.
>
> Our idea:
>
>  - The first clean phase works like the current implementation
>
>  - The second clean phase is optional and does nothing except the user
> implements it.
>
>  - In the second clean phase your are allowed to peek into
>    the results of the first clean phase.
>    The clean method for the second phase would need to get the other values
> passed in.

How is this different from the existing behaviour of clean_FOO(),
followed by clean()? Is that not "clean phase 1" and "clean phase 2"?

On Wed, Mar 25, 2015 at 2:14 PM, Preston Timmons
<prestontimm...@gmail.com> wrote:
> There are times when I've definitely wanted this feature. Particularly, when
> multiple fields on a form have this type of constraint. Putting all the
> logic in the clean method gets convoluted.

You can place each multi field constraint to be tested in to its own
method and call them from clean() if it gets too unwieldy.

Cheers

Tom

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at http://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/CAFHbX1LMrvA4zE2yt%3DhLV-SW%2B6dzP8paUDZR2qfWc%3Dr2-TAcuA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to