I've tried everything found:
Can stale content types be automatically deleted in Django?
Deleting unused Models, stale content types prompt
InvalidBasesError: Cannot resolve bases for [<ModelState: 'users.GroupProxy'>]
Django Wagtail CMS migrate: Cannot resolve bases for [<ModelState: 'app.CustomPage'>
So here's my problem: I have:
- a
ComicBook
that has a many-to-manyPlanche
's - a
Planche
that has a many-to-manyBande
's - a
Bande
that has a many-to-manyVignette
's - ... and three levels deeper (it's not important it's always the same principle)
I needed in-between many-to-many tables to add "importance
" field to be able to make a custom sort of the relationships. Thus I've created
- a
ComicBookPlanche
that is the many-to-many table with fieldimportance
- a
PlancheBande
that is the many-to-many table with fieldimportance
Everything was working perfectly until I decide to rename ComicBook
to Book
. From now on I always get the message django.db.migrations.state.InvalidBasesError: Cannot resolve bases for...
I even tried to drop all the tables and migration folder, nothing changed... I tried to comment my application -> great then un-comment and still:
django.db.migrations.state.InvalidBasesError:
Cannot resolve bases for
[<ModelState: 'main.TexteLongTextesThrough'>,
<ModelState: 'main.TexteCourtTextesThrough'>,
<ModelState: 'main.VignetteBullesThrough'>,
<ModelState: 'main.LivrePlanchesThrough'>]
I'm getting mad. So here's what I did:
- brand new application
makemigrations
thenmigrate
-> auth, admin, sessions, sites created no problem- copy/paste my
models.py
withoutadmin.py
.
makemigrations
-> perfect:
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
Then migrate
-> perfect:
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
Then copy/paste my admin.py
then makemigrations
-> perfect:
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
Then each time I try migrate
it keeps asking me this, no matter if I anwser "yes" or "no":
>>> 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
What can I do to make him stop asking, and what is the problem?