On Mar 29, 2009, at 9:35 AM, Matthew Somerville wrote: > > 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/
Thanks, that's really useful to know about. This works for most of the additional validation I need to do, but doesn't fit so well for the cross-field validation, (e.g. password and confirm_password fields match). Or can I do that by overriding Form.is_valid? Jack --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---