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

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -