每次尝试migrate
我的初始迁移,就在makemigrations
之后,我都会遇到如下错误:
django.db.migrations.exceptions.InvalidBasesError: Cannot resolve bases for [<ModelState: 'Project.Class'>]
This can happen if you are inheriting models from an app with migrations (e.g. contrib.auth)
我认为发生这种情况的原因是0001_initial.py
迁移中模型operations
的顺序不正确。具有从其他类继承的类的操作被添加到其父类的前面。在我对操作重新排序之后,它工作:Process finished with exit code 0
。酷!但是,如果每次都不这样做,我如何使makemigrations
工作呢?你知道吗
谢谢!你知道吗
另外,我尝试在模型的__init__.py
中重新排序模型的导入顺序,但没有成功。你知道吗
目前没有回答
相关问题 更多 >
编程相关推荐