我已经尝试了所有发现:
InvalidBasesError:无法解析 [<ModelState: 'users.GroupProxy'>] 的基础
Django Wagtail CMS 迁移:无法解析 [<ModelState: 'app.CustomPage'> 的基础
Django 使用 zinnia 迁移 - InvalidBasesError: Cannot resolve bases for [<ModelState: 'zinnia.Author'>]
所以这是我的问题:我有:
- a
ComicBook
有一个多对多Planche
的 - a
Planche
有一个多对多Bande
的 - a
Bande
有一个多对多Vignette
的 - ...以及更深的三个层次(这并不重要,它始终是相同的原则)
我需要在多对多表之间添加“ importance
”字段,以便能够对关系进行自定义排序。因此我创建了
- a
ComicBookPlanche
那是带有字段的多对多表importance
- a
PlancheBande
那是带有字段的多对多表importance
在我决定重命名ComicBook
为Book
. 从现在开始我总是收到消息django.db.migrations.state.InvalidBasesError: Cannot resolve bases for...
我什至试图删除所有的表 和 迁移文件夹,没有任何改变......我试图评论我的应用程序 - >很好然后取消评论并且仍然:
django.db.migrations.state.InvalidBasesError:
Cannot resolve bases for
[<ModelState: 'main.TexteLongTextesThrough'>,
<ModelState: 'main.TexteCourtTextesThrough'>,
<ModelState: 'main.VignetteBullesThrough'>,
<ModelState: 'main.LivrePlanchesThrough'>]
我快疯了。所以这就是我所做的:
- 全新的应用
makemigrations
然后migrate
-> auth、admin、sessions、sites created 没问题- 复制/粘贴我的
models.py
不带admin.py
.
makemigrations
-> 完美:
Migrations for 'main':
0001_initial.py:
- Create model Bande
- Create model BandeVignette
- Create model Bulle
- Create model ContenuCourt
- Create model ContenuLong
- Create model Langue
- Create model Livre
- Create model Personne
- Create model Planche
- Create model PlancheBande
- Create model TexteCourt
- Create model TexteLong
- Create model Vignette
- Add field description to planche
- Add field planches to livre
然后migrate
->完美:
Operations to perform:
Synchronize unmigrated apps: staticfiles, messages
Apply all migrations: sessions, admin, sites, auth, contenttypes, main
Synchronizing apps without migrations:
Creating tables...
Running deferred SQL...
Installing custom SQL...
Running migrations:
Rendering model states... DONE
Applying main.0001_initial... OK
Process finished with exit code 0
然后复制/粘贴我的admin.py
then makemigrations
-> 完美:
Migrations for 'main':
0002_livreplanchesthrough_textecourttextesthrough_textelongtextesthrough_vignettebullesthrough.py:
- Create proxy model LivrePlanchesThrough
- Create proxy model TexteCourtTextesThrough
- Create proxy model TexteLongTextesThrough
- Create proxy model VignetteBullesThrough
Process finished with exit code 0
然后每次我尝试migrate
它都会问我这个,无论我回答“是”还是“否”:
>>> migrate
Operations to perform:
Synchronize unmigrated apps: staticfiles, messages
Apply all migrations: sessions, admin, sites, auth, contenttypes, main
Synchronizing apps without migrations:
Creating tables...
Running deferred SQL...
Installing custom SQL...
Running migrations:
No migrations to apply.
The following content types are stale and need to be deleted:
main | textelong_textes
main | textecourt_textes
main | livre_planches
main | vignette_bulles
Any objects related to these content types by a foreign key will also
be deleted. Are you sure you want to delete these content types?
If you're unsure, answer 'no'.
Type 'yes' to continue, or 'no' to cancel: yes
Process finished with exit code 0
我该怎么做才能让他停止询问,问题是什么?