Django highly suggests not to use null=True
for CharField and TextField string-based fields in order not to have two possible values for "no data" (assuming you're allowing empty strings with blank=True
). This makes total sense to me and I do this in all my projects.
Django 1.9 introduces JSONField, which uses the underlying Postgres jsonb
data type. Does the suggestion above carry over to JSONField (i.e. blank=True
should be used instead of null=True
)? Or, should null=True
be used instead? Or, should default=dict
be used instead? Or, ..? Why?
In other words, what is the convention for the new native JSONField, when you want to allow only one "no data" value? Please support your answer because I did a lot of research and couldn't find anything official. Thanks in advance.