python - How to set NULL for IntegerField instead of setting 0? -
i'm uploading data excel file using xlrd , turning data models (with integerfield values) in django. excel file has bunch of missing data. unfortunately, these missing data converted value of 0 in models, instead of null. means when person model doesn't have age, age gets recorded 0, instead of null.
what's best way change this? i've tried doing this:
age = models.integerfield(blank=true, null=true)
but blank fields still set 0 default.
instead of using
age = models.integerfield(blank=true, null=true)
use
age = models.integerfield()
when donot specify
blank=true, null=true
it store null in column
Comments
Post a Comment