status = models.IntegerField(choices=list(CAMPAIGN_STATUS), default=CAMPAIGN_STATUS.PAUSE,
verbose_name=_("status"), blank=True, null=True)
What is the difference in blank=True, null=True ?
status = models.IntegerField(choices=list(CAMPAIGN_STATUS), default=CAMPAIGN_STATUS.PAUSE,
verbose_name=_("status"), blank=True, null=True)
What is the difference in blank=True, null=True ?
blank=True
is about validation, True
means that field is not required. null=True
allows you to save a null value.
Also you are not always need to define both of them when you want optional field. String value, like a CharField
or a TextField
are better be stored in an empty string, so you should use only blank=True
.
In your case, with not required IntegerField
you should use both blank
and null
here the docs