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 sobot
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
Augustin's correct :)
If I could suggest a solution, I would like to have a `null=False` argument
on form fields. I believe this would fix the problems noted above and be
sort of backwards-compatible. When using model forms, the argument would be
set according to the `null` attribute of the res
On Thu, Nov 7, 2013 at 10:59 AM, Aymeric Augustin <
aymeric.augus...@polytechnique.org> wrote:
> But if you're using a ModelForm — like the admin does — then you need some
> code to convert empty strings to None. I believe that's the problem
> Vlastimil wants to solve.
>
Got it.
Thanks for the c
2013/11/7 Elyézer Rezende
> Setting null=True in the field definition and doing model.field = None
> doesn't do this?
>
At the model layer, yes.
But if you're using a ModelForm — like the admin does — then you need some
code to convert empty strings to None. I believe that's the problem
Vlastim
Setting null=True in the field definition and doing model.field = None
doesn't do this?
If you create a gist or a paste with a sample code would help understand
better.
On Thu, Nov 7, 2013 at 8:37 AM, Vlastimil Zíma wrote:
> Hi everybody,
>
> I know this was here before, but it is really a pro
On Thu, Nov 7, 2013 at 5:37 AM, Vlastimil Zíma wrote:
> 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.
>
A concrete proposal would he
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