Skip to content Skip to sidebar Skip to footer

How To Set Null For Integerfield Instead Of Setting 0?

I'm uploading some data from an excel file using xlrd and turning that data into models (with mainly IntegerField values) in Django. My excel file has a bunch of missing data. Unfo

Solution 1:

Instead of using

age = models.IntegerField()

use

age = models.IntegerField(blank=True, null=True)

When we specify

blank=True, null=True

it will allow you to store null in that column

Post a Comment for "How To Set Null For Integerfield Instead Of Setting 0?"