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:
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.