On Sat, 2007-03-10 at 16:59 -0600, Greg Donald wrote:
> On 3/10/07, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote:
> > I assume you mean via some way other than a form or the admin interface,
> 
> Model validation doesn't occur in the model itself?

Validation happens on the strings submitted from a form, *before* they
are converted to Python objects (since there's no guarantee we can
convert them without error). We do not have model-aware validation at
the moment, but it is coming. Note that what we do have is still good
for the majority of cases, because you have access to all the submitted
fields. What you don't have access to is the instance of the model that
will be affected in the case where you are updating an existing
instance. That is the feature we will add eventually.

> 
> > because in those two cases, field validation should catch it.
> 
> What is "field validation" exactly?

See http://www.djangoproject.com/documentation/forms/#validators for a
description of how validators work. Although that page talks about
validators in the context of form submissions, they are the same
validators that you can specify on models.*Field classes as well.

Suffice it to say that, in your case, when you submit a string as part
of a form submission to go into your field, Django will ensure that it
is non-empty, because you have blank=False.

Regards,
Malcolm



--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to