Alesandro: Thanks for link, but this does not quite solve the issue.

1. I don't want user to decide how data gets stored in database. That's my 
(developer) decision.
2. There are other text fields which stores data as text in database - e.g. 
URLField and even the FileField.

Vlastimil

Dne sobota, 9. listopadu 2013 10:49:40 UTC+1 Alessandro Pagnin napsal(a):
>
> I had the same problem to solve, and I made this app to solve the problem 
> https://github.com/alepane21/django-nullablecharfield.
> On the "widget level" it adds to the right of the field a checkbox to 
> click to set the value to None/NULL.
>
> On Thursday, November 7, 2013 11:37:47 AM UTC+1, Vlastimil Zíma wrote:
>>
>> Hi everybody,
>>
>> I know this was here before, but it is really a problem. We need (I 
>> literally mean need, not just want) a simple way to store NULL in database 
>> instead of ''. Using empty string has several serious consequences (in 
>> databases which distinguishes between NULL and '', which are to my 
>> knowledge all but oracle).
>>
>>  * You can't make a model with unique optional field. Django admin will 
>> let you store only one object without the value, because others with 
>> conflict the unique constraint.
>>  * It is useless to set NOT NULL constraints on text fields. Because 
>> Django stores empty string as empty value, database will not complain about 
>> invalid data and just stores the rubbish.
>>
>> I don't want to enforce anybody to use only NULL as empty value, I just 
>> want Django to store NULL in database when I told it to. And I don't mean 
>> the way of overriding all the form fields as I have to now.
>>
>> Regards,
>> Vlastimil
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/8361e71a-bd3b-47cf-8d69-ee31480d196a%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to