I have a model with Field like
key = CharField(max_length=100, blank=True)
when i check for the value after form submission like this.
if self.key is None:
the condition fails
But when i check for if self.key == ''
it works.
My question is why it doesn't works when i evaluate it to None
and works when i use ''
.
The None
condition works only when i assign the values like this.
key = CharField(max_length=100, null=True ,blank=True)
I read some posts where it states that when evaluating the CharField as blank=True
an empty string ''
is saved but they didn't shed any light why it does that. because as far i understand it should save a Null value.