Answers for "using default as none in django mdoels"

0

using default as none in django mdoels

>>> type('')
<class 'str'>
>>> type(None)
<class 'NoneType'>
>>>

Avoid using null on string-based fields such as CharField and TextField. 
If a string-based field has null=True, that means it has two possible values for “no data”: NULL, and the empty string. 
In most cases, it’s redundant to have two possible values for “no data;” 
the Django convention is to use the empty string, not NULL.
One exception is when a CharField has both unique=True and blank=True set. 
In this situation, null=True is required to avoid unique constraint violations when saving multiple objects with blank values.
Posted by: Guest on August-24-2021

Python Answers by Framework

Browse Popular Code Answers by Language