Hi Tim,

My use case in practice is effectively this - in the clean() method for a
form that has a 'code' field, plus a number of others:

    def clean(self):
        ...
        try:
            validate_code(self.instance, code)
        except ValidationError as e:
            self._errors = e.update_error_dict(self._errors)
            del cleaned_data['code']
        ...

It's not quite the same as the example in the docs, because validate_code
might return an error with a field *other* than code (i.e., code is valid,
but as a result of the new value in code, another field isn't).

Russ %-)

On Fri, Jun 27, 2014 at 9:13 PM, Tim Graham <[email protected]> wrote:

> Russ, could you include a code snippet of what no longer works? I think
> there is a documented solution that involves modifying Form._errors (see
> https://docs.djangoproject.com/en/1.6/ref/forms/validation/#django.forms.Form.clean),
> but I'm not sure if you're doing that or something different. The 1.7
> version of that example now uses Form.add_error().
>
> On Friday, June 27, 2014 8:41:50 AM UTC-4, Russell Keith-Magee wrote:
>
>>
>> On Fri, Jun 27, 2014 at 7:35 PM, Curtis Maloney <
>> [email protected]> wrote:
>>
>>> Am I reading this right as "people used to commonly solve this problem
>>> by using an internal API, but now we have a public one... AND the old
>>> internal API is now changed"?
>>>
>>> If so, the solution seems obvious -- document that it's time to move the
>>> the official solution :)
>>>
>>
>> Broadly speaking, I agree. However, my hesitation in categorically
>> agreeing stems from the fact that ValidationError *is* public API. Or, at
>> least, the constructor is, - but it seems a little absurd that we formally
>> document a way for people to construct an object, but not to support any of
>> the ways that they might have *used* that object.
>>
>> Yours,
>> Russ Magee %-)
>>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django developers" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> 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/d87963aa-ee2c-47d8-a9f1-2eb5b78a6c0b%40googlegroups.com
> <https://groups.google.com/d/msgid/django-developers/d87963aa-ee2c-47d8-a9f1-2eb5b78a6c0b%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
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/CAJxq848N%3DNqxvrsaVoBmYhh4%3DL8FagMoRQZBJREbMGm2HOdg7g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to