Re: Two phase cleaning of models/forms

2015-04-08 Thread Raphael Michel
Hi, Am Thu, 2 Apr 2015 09:15:42 -0700 (PDT) schrieb Preston Timmons : > One use case is for validating address forms. We deal with a lot of > them with varying levels of validation based on country, state, zip > code, etc. Sometimes, multiple sets of address fields appear on the > same form. We ca

Re: Two phase cleaning of models/forms

2015-04-08 Thread Thomas Güttler
Since `field_order` will be in Django 1.9 the second clean loop is hardly needed in my case. https://github.com/django/django/commit/28986da4ca167ae257abcaf7caea230eca2bcd80 Am 08.04.2015 um 14:20 schrieb Thomas Güttler: Am 26.03.2015 um 15:12 schrieb Marc Tamlyn: In particular it is worth n

Re: Two phase cleaning of models/forms

2015-04-08 Thread Thomas Güttler
Am 26.03.2015 um 15:12 schrieb Marc Tamlyn: In particular it is worth noting the addition of form.add_error[1] in Django 1.7 which makes long clean methods much nicer to handle. [1] https://docs.djangoproject.com/en/1.7/ref/forms/api/#django.forms.Form.add_error Yes, you are right. My propo

Re: Two phase cleaning of models/forms

2015-04-02 Thread Preston Timmons
Yep, I think you're right now. Given existing solutions there's not warrant enough to add another built-in validation hook. Preston -- You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group. To unsubscribe from this

Re: Two phase cleaning of models/forms

2015-04-02 Thread Carl Meyer
Hi Preston, On 04/02/2015 10:15 AM, Preston Timmons wrote: > Since I think this can be a useful feature, I'll explain why. > > One use case is for validating address forms. We deal with a lot of > them with varying levels of validation based on country, state, zip > code, etc. Sometimes, multiple

Re: Two phase cleaning of models/forms

2015-04-02 Thread Preston Timmons
Since I think this can be a useful feature, I'll explain why. One use case is for validating address forms. We deal with a lot of them with varying levels of validation based on country, state, zip code, etc. Sometimes, multiple sets of address fields appear on the same form. We can't simply reuse

Re: Two phase cleaning of models/forms

2015-04-02 Thread Tom Evans
On Wed, Mar 25, 2015 at 9:37 AM, Thomas Güttler 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 t

Re: Two phase cleaning of models/forms

2015-03-26 Thread Marc Tamlyn
In particular it is worth noting the addition of form.add_error[1] in Django 1.7 which makes long clean methods much nicer to handle. [1] https://docs.djangoproject.com/en/1.7/ref/forms/api/#django.forms.Form.add_error On 25 March 2015 at 16:11, Carl Meyer wrote: > Hi Thomas, > > On 03/25/2015

Re: Two phase cleaning of models/forms

2015-03-25 Thread Carl Meyer
Hi Thomas, On 03/25/2015 03:37 AM, Thomas Güttler 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 >

Re: Two phase cleaning of models/forms

2015-03-25 Thread Wim Feijen
Great proposal and I'd love it on forms. I'm not sure about models, though. I always use forms for sanitization. On Wednesday, 25 March 2015 10:37:43 UTC+1, guettli wrote: > > Up to now the validation/cleaning of a attribute can not access the > value of an other attribute. > > The work around

Re: Two phase cleaning of models/forms

2015-03-25 Thread Preston Timmons
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 received this message because you are subscribed to the Google Groups "Django developers (Con

Two phase cleaning of models/forms

2015-03-25 Thread Thomas Güttler
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 p