On Wed, Jun 16, 2010 at 5:14 PM, aurel...@gmail.com <aurel...@gmail.com>wrote:

> Thanks Karen!
>
> Django 1.0 Web Site Development book (code example is from that book)
> has following paragraph:
> "By specifying correct field types in our form, we don't have to
> implement any
> additional input validation. For example, Django will automatically
> make sure
> that the user enters a valid URL because the corresponding field is
> defined as
> models.URLField."
>
> So book has error, at least for Django 1.2
>

I don't have that book so can't tell whether there is additional context
around whatever example is being discussed that makes the example work, but
this does sound a bit off. Django 1.0 did not have any model validation so
the only validation possible was via forms. By default a model form built
from a model will do all the validation noted for the model field. But if
you do not use a model form, or if you explicitly override any of the model
fields with your own specification for the form fields, then you are
responsible for ensuring that the form field you manually specify has all
the validation characteristics that you are looking for -- it won't be
somehow inherited from the associated model field. There is a note as far
back as the 1.1 documentation to this effect:
http://docs.djangoproject.com/en/1.1/topics/forms/modelforms/#overriding-the-default-field-types

The publisher of that book has a page for submitting errata:
https://www.packtpub.com/submit-errata

Karen
-- 
http://tracey.org/kmt/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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