Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

integrity error - integerfield may not be null

Tags:

django

class Incubator(models.Model):
    name = models.CharField(max_length=30)
    category = models.CharField(max_length=30, blank=True)
    acceptanceRate = models.DecimalField(max_digits=5, decimal_places=2, blank=True, null=True)
    funding = models.IntegerField()
    programLength = models.DecimalField(max_digits=4, decimal_places=2)
    kloutScore = models.IntegerField(blank=True, null=True)
    companies = models.ManyToManyField(Company, blank=True)

    def __unicode__(self):
        return self.name

When i leave any of the integerfields blank, i keep getting an error that says,

IntegrityError at /admin/incubators/incubator/add/
incubators_incubator.kloutScore may not be NULL

I thought by putting blank=true and null=true, it would solve that problem?

like image 333
anc1revv Avatar asked Jul 05 '12 02:07

anc1revv


1 Answers

it's because I added "blank=true" and "null=true" after i already created the databases. I had to delete my db and then "syncdb" and then it worked.

like image 91
anc1revv Avatar answered Sep 28 '22 10:09

anc1revv