【发布时间】:2014-11-15 20:13:19
【问题描述】:
我正在使用 userena 并在我的 models.py 中添加以下行
zipcode = models.IntegerField(_('zipcode'),
max_length=5)
点击注册表单上的提交按钮后出现以下错误:
IntegrityError at /accounts/signup/
NOT NULL constraint failed: accounts_myprofile.zipcode
我的问题是这个错误是什么意思,这与 Userena 有关系吗?
【问题讨论】:
-
您运行迁移了吗?默认情况下,Django 不会接受对模型的更改。而且,如果不指定
null=True, blank=True,则成为必填字段 -
设置 null 和空白不会改变任何东西。即使删除属性也无济于事。
标签: django django-models