#23521: removal of concrete Model from bases doesn't remove it from ModelState
bases
----------------------------+--------------------------------------
Reporter: sir-sigurd | Owner: sir-sigurd
Type: Bug | Status: new
Component: Migrations | Version: 1.7
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
----------------------------+--------------------------------------
Changes (by Markush2010):
* cc: info+coding@… (added)
Old description:
> Steps to reproduce:
>
> * add `test` app with `models.py`:
> {{{
> class Thing(models.Model):
> pass
>
> class SuperThing(Thing):
> pass
> }}}
>
> * do
>
> {{{
> manage.py makemigrations test
> }}}
>
> * change `models.py`:
> {{{
> 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
> }}}
New description:
Steps to reproduce:
* add `test` app with `models.py`:
{{{
class Thing(models.Model):
pass
class SuperThing(Thing):
pass
}}}
* do
{{{
manage.py makemigrations test
}}}
* change `models.py` (remove `Thing`):
{{{
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
}}}
--
--
Ticket URL: <https://code.djangoproject.com/ticket/23521#comment:5>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/068.f1f2ab5d9fd06a7ab9b914c6b7b29978%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.