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
Run Code Online (Sandbox Code Playgroud)
当我将任何整数字段留空时,我不断收到错误消息,
IntegrityError at /admin/incubators/incubator/add/
incubators_incubator.kloutScore may not be NULL
Run Code Online (Sandbox Code Playgroud)
我认为通过将blank = true和null = true,它会解决这个问题吗?
这是因为我已经创建了数据库后添加了"blank = true"和"null = true".我不得不删除我的数据库然后"syncdb"然后它工作.
| 归档时间: |
|
| 查看次数: |
9087 次 |
| 最近记录: |