On May 15, 8:53 pm, Christophe Pettus <x...@thebuild.com> wrote:
> On May 15, 2011, at 2:15 PM, Greg Donald wrote:
>
> > How do I set a default for a BooleanField() ?
>
> > I tried
>
> > foo = models.BooleanField( default=False )
>
> > but that only produces
>
> > foo boolean NOT NULL,
>
> The default= parameter in Django doesn't generate a DEFAULT in the SQL; the 
> default is implemented in the Django ORM.
>

This is a very subtle point.  The docs for "default":
http://docs.djangoproject.com/en/1.3/ref/models/fields/#default
do not explicitly say anything about creating any SQL-related code;
therefore perhaps best to assume that Django does not.  In effect (and
this is a very crude way of putting it), a Django model is a
"superset" of a SQL table.

-- 
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