Opened 10 years ago
Last modified 8 months ago
#23521 assigned Bug
removal of concrete Model from bases doesn't remove it from ModelState bases — at Version 5
Reported by: | Sergey Fedoseev | Owned by: | |
---|---|---|---|
Component: | Migrations | Version: | dev |
Severity: | Normal | Keywords: | |
Cc: | info+coding@…, bugs@…, ericmills2@…, Charlie Denton, Ian Foote, Daniel Rios, Sardorbek Imomaliev | Triage Stage: | Accepted |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | yes |
Easy pickings: | no | UI/UX: | no |
Description (last modified by )
Steps to reproduce:
- add
test
app withmodels.py
:class Thing(models.Model): pass class SuperThing(Thing): pass
- do
manage.py makemigrations test
- change
models.py
(removeThing
):class SuperThing(models.Model): thing_ptr = models.AutoField(primary_key=True)
- do
manage.py makemigrations test
- do it one more time
manage.py makemigrations test
last command results in
django.db.migrations.state.InvalidBasesError: Cannot resolve bases for [<ModelState: 'test.SuperThing'>] This can happen if you are inheriting models from an app with migrations (e.g. contrib.auth) in an app with no migrations; see https://docs.djangoproject.com/en/1.7/topics/migrations/#dependencies for more
Change History (5)
comment:1 by , 10 years ago
Component: | Uncategorized → Migrations |
---|---|
Type: | Uncategorized → Bug |
follow-up: 3 comment:2 by , 10 years ago
comment:3 by , 10 years ago
Replying to bmispelon:
Hi,
Probably this is not obvious, but removal of Thing
model from models.py
, not only from SuperThing
bases was implied.
As a side note, it's not possible to create an app called
test
because you get this error when doingmanage.py startapp test
I have never used this for creating apps =)
comment:4 by , 10 years ago
Triage Stage: | Unreviewed → Accepted |
---|
Thanks, that's the bit I was missing.
comment:5 by , 10 years ago
Cc: | added |
---|---|
Description: | modified (diff) |
Note:
See TracTickets
for help on using tickets.
Hi,
I can't reproduce the issue you're describing.
On master, the second
makemigrations
doesn't detect any changes.On
stable/1.7.x
, it does create a migration but running it a third time works (and detects no change as expected).As a side note, it's not possible to create an app called
test
because you get this error when doingmanage.py startapp test
:Can you provide us with some details on how you're trigerring the issue?
Thanks.