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/3601f293-0d5c-4b2a-9604-c86f5b671830%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to