Thursday, March 1, 2012

null field issue

I have a model with a filed like
name = models.CharField(max_length=255, blank=True, null=True)

With Django admin I've created some instances of that model without
filling name field. Now I'm querying that model with name__isnull=True
and the filter doesn't return any single object!! acctually on the
database (postgresql) the name field is an empty string '' instead of
the expected NULL.

Why the admin fills name field with an empty string? Is this a normal
behaviour?

--
Marc

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment