Hi --
I know there's a lot of confusion over empty strings and
NULLs, and
I've read a bunch of the threads about them, but I can't
seem to find a
solution to this problem:
Basically, I want to be able to leave a field blank in the
admin, and
have it insert an empty string instead of a NULL into the
database (so
that the field can be set to NOT NULL and PosgreSQL won't
barf).
The docs seem to imply that Django will do this, but I can't
get it to.
-----------
If True, Django will store empty values as NULL in the
database.
Default is False.
Note that empty string values will always get stored as
empty strings,
not as NULL -- so use null=True for non-string fields such
as integers,
booleans and dates.
------------
Here's my field definition:
notes = models.CharField(maxlength=200, null=False,
default='',
blank=True)
However, every time I try to use the admin to add a record
where the
"notes" field is empty, I get an error from the
database about
inserting a NULL value. Why doesn't it use the specified
default? Do
I have to override the save() method or something?
Thanks.
--~--~---------~--~----~------------~-------~--~----~
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 htt
p://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---
|