Jack Orenstein wrote:
> On Mar 28, 2009, at 12:26 PM, Daniel Roseman wrote:
> 
>> On Mar 28, 4:14 pm, Jack Orenstein <j...@geophile.com> wrote:
>>> My application needs to validate data from a from beyond the
>>> validation of Fields done by django. So in my form handler, I check
>>> Form.is_valid, and if that returns true, then I do my own validation.

If you have a field you need to perform more validation on, what you 
should do is give your Form subclass a clean_<fieldname>() method which 
will be called automatically, and should raise a ValidationError if the 
data doesn't validate (which will then put the error in the right place 
for you). Then is_valid() will do Django and your validation together. 
For more information, see 
http://docs.djangoproject.com/en/dev/ref/forms/validation/

>> Try self.form._errors['foobar'] instead.
> 
> That works, thank you.
> 
> Why does it work?

http://docs.djangoproject.com/en/dev/ref/forms/validation/#form-subclasses-and-modifying-field-errors
 
explains the _errors variable, but I don't think you need it in this case.

ATB,
Matthew

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to