我对模型进行了更改,从
standard = models.ManyToManyField(Standard)
至
standard = models.ManyToManyField(Standard, blank=True, null=True)
这个应用程序的South模式迁移没有识别到这个更改吗?
与这个未被回答的问题类似: South migrations and changes to many-to-may fields
我对模型进行了更改,从
standard = models.ManyToManyField(Standard)
至
standard = models.ManyToManyField(Standard, blank=True, null=True)
这个应用程序的South模式迁移没有识别到这个更改吗?
与这个未被回答的问题类似: South migrations and changes to many-to-may fields
null
与 ManyToManyField
一起使用时在数据库层面上并没有任何意义。声明 ManyToManyField
会导致创建一个中间表来保存关系,尽管 Django 会为您方便地在模型实例上创建一个 standard
属性,但实际上并不存在代表它的可空列。按照定义,关系始终可以有零个实例。blank=False
在验证方面(例如在使用模型表单(如管理应用程序)时)确实会产生影响,强制用户选择至少一个关系。
./manage.py schemamigration yourapp --auto
时,South 到底会说什么? - Daniel Rosenthalmodels.py
,但我非常怀疑这个。很抱歉我无法提供帮助。 - Daniel Rosenthal