Testing empty / empty string in django

I have a charfield with the following:

myString = models.CharField(max_length=50,null=True,blank=True)

In many of my objects, this particular line often remains empty when it is created through the django admin interface. In MySQL, a VARCHAR (50) column with a default value = NULL.

Regardless of what I'm trying to do in my view.py, to detect empty values, it always seems to be false, whether the record is empty or not:

myString is None
myString==""
len(myString)==0

How can I distinguish between whitespace and non-blank values ​​for this field?

thank

EDIT:

The actual representation is as follows: I want to execute a block only if this field is not empty.

if myObject.myString:
     #do something

the block is always executed, and I tried all the above test examples for an empty field.

EDIT 2:

Scratch what if myObject.myString:really works.

+6
4

d None "", -

if d: 
    #do something
else:
    #do something else
+9

, None. , , False, . . :

if d in [None, '']:
    # This field is empty.
+10

myString - a models.CharField. , .

,

if model_instance.myString:

, .

+3

, None '' (),

if my_string:
  # neither None nor blank
0
source

All Articles