models and NULL in postgres

40 views
Skip to first unread message

hack

unread,
Mar 15, 2012, 10:18:09 PM3/15/12
to django...@googlegroups.com
Something is a little strange with my database.  My models have fields where the value is set as blank=True to allow null values.  My forms seem to be saving values to the database just fine, even if the are blank/null.  However, when I look at my database in phppgadmin all the rows show they are set as NOT NULL, which implies they should not allow null values to be saved.  Is there some bug with django and postres, which I am not aware of?  Maybe just a bug in phppgadmin.  Thanks.

Donald Stufft

unread,
Mar 15, 2012, 10:19:47 PM3/15/12
to django...@googlegroups.com
Django uses an empty string instead of a NULL for an empty value for CharField and Charfield subclasses

On Thursday, March 15, 2012 at 10:18 PM, hack wrote:

Something is a little strange with my database.  My models have fields where the value is set as blank=True to allow null values.  My forms seem to be saving values to the database just fine, even if the are blank/null.  However, when I look at my database in phppgadmin all the rows show they are set as NOT NULL, which implies they should not allow null values to be saved.  Is there some bug with django and postres, which I am not aware of?  Maybe just a bug in phppgadmin.  Thanks.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/WPIOw8u8trkJ.
To post to this group, send email to django...@googlegroups.com.
To unsubscribe from this group, send email to django-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

hack

unread,
Mar 15, 2012, 10:34:40 PM3/15/12
to django...@googlegroups.com
Ahhh, that makes sense.  Thanks.  :)


On Thursday, March 15, 2012 10:19:47 PM UTC-4, dstufft wrote:
Django uses an empty string instead of a NULL for an empty value for CharField and Charfield subclasses

On Thursday, March 15, 2012 at 10:18 PM, hack wrote:

Something is a little strange with my database.  My models have fields where the value is set as blank=True to allow null values.  My forms seem to be saving values to the database just fine, even if the are blank/null.  However, when I look at my database in phppgadmin all the rows show they are set as NOT NULL, which implies they should not allow null values to be saved.  Is there some bug with django and postres, which I am not aware of?  Maybe just a bug in phppgadmin.  Thanks.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/WPIOw8u8trkJ.
To post to this group, send email to django...@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages