On Mon, Aug 10, 2009 at 1:59 PM, AG <anthony...@gmail.com> wrote:

>
> I have a field:
> revision = models.IntegerField(default=0)
> on a model.
>
> I assumed that if I set a default value for a field, I am free to
> create an object that does not set 'revision', and save it.
> However, this produces an IntegrityError:
> IntegrityError: XXX.revision may not be NULL
>
> When I check the get_default value for this field, I get 0. Why is
> this field not set during a save()?
>

How exactly are you creating the object that does not set revision?

I cannot recreate the IntegrityError except by explicitly setting revision
to None, which is different from not specifying it.  If it is not specified,
it will be set to the default value, at least in my testing.

Karen

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