[Django] #22922: 1.7RC1 introduces InvalidBasesError when migrating with a Model that extends User

Skip to first unread message

Django

unread,
Jun 28, 2014, 4:28:15 PM6/28/14
to django-...@googlegroups.com
#22922: 1.7RC1 introduces InvalidBasesError when migrating with a Model that
extends User
-------------------------------+----------------------
Reporter: bufke | Owner: nobody
Type: Uncategorized | Status: new
Component: Migrations | Version: 1.7-rc-1
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+----------------------
Extend the User model using this method

{{{
from django.contrib.auth.models import User

class Faculty(User):
foo = models.CharField(max_length=10)
}}}

In 1.7 beta 4 this works. With 1.7RC1 I get:

{{{
Running migrations:
Applying contenttypes.0001_initial...Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/usr/local/lib/python2.7/dist-
packages/django/core/management/__init__.py", line 385, in
execute_from_command_line
utility.execute()
File "/usr/local/lib/python2.7/dist-
packages/django/core/management/__init__.py", line 377, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/usr/local/lib/python2.7/dist-
packages/django/core/management/base.py", line 288, in run_from_argv
self.execute(*args, **options.__dict__)
File "/usr/local/lib/python2.7/dist-
packages/django/core/management/base.py", line 337, in execute
output = self.handle(*args, **options)
File "/usr/local/lib/python2.7/dist-
packages/django/core/management/commands/migrate.py", line 160, in handle
executor.migrate(targets, plan, fake=options.get("fake", False))
File "/usr/local/lib/python2.7/dist-
packages/django/db/migrations/executor.py", line 62, in migrate
self.apply_migration(migration, fake=fake)
File "/usr/local/lib/python2.7/dist-
packages/django/db/migrations/executor.py", line 90, in apply_migration
if self.detect_soft_applied(migration):
File "/usr/local/lib/python2.7/dist-
packages/django/db/migrations/executor.py", line 134, in
detect_soft_applied
apps = project_state.render()
File "/usr/local/lib/python2.7/dist-
packages/django/db/migrations/state.py", line 71, in render
raise InvalidBasesError("Cannot resolve bases for %r" %
new_unrendered_models)
django.db.migrations.state.InvalidBasesError: Cannot resolve bases for
[<django.db.migrations.state.ModelState object at 0x7f5d6af3ad50>]
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/22922>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Jun 28, 2014, 4:33:20 PM6/28/14
to django-...@googlegroups.com
#22922: 1.7RC1 introduces InvalidBasesError when migrating with a Model that
extends User
-------------------------------+--------------------------------------

Reporter: bufke | Owner: nobody
Type: Uncategorized | Status: new
Component: Migrations | Version: 1.7-rc-1
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------
Changes (by bufke):

* needs_better_patch: => 0
* needs_tests: => 0
* needs_docs: => 0


Comment:

To reproduce you must not have 1.7 migrations for the app. On a app
created with 1.7 you can just remove the migrations folder. I noticed the
problem when trying 1.7 on an existing <1.7 django app and creating a
fresh database with migrate.

--
Ticket URL: <https://code.djangoproject.com/ticket/22922#comment:1>

Django

unread,
Jun 28, 2014, 4:40:18 PM6/28/14
to django-...@googlegroups.com
#22922: 1.7RC1 introduces InvalidBasesError when migrating with a Model that
extends User
-------------------------------+--------------------------------------

Reporter: bufke | Owner: nobody
Type: Uncategorized | Status: new
Component: Migrations | Version: 1.7-rc-1
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------

Comment (by timo):

You cannot have apps without migrations depend on apps with migrations
which I think is the issue here. See
https://docs.djangoproject.com/en/dev/topics/migrations/#dependencies

It may be worth trying to raise a more useful error message, however.

--
Ticket URL: <https://code.djangoproject.com/ticket/22922#comment:2>

Django

unread,
Jun 30, 2014, 6:09:03 PM6/30/14
to django-...@googlegroups.com
#22922: Add a better error messsage or an FAQ entry for InvalidBasesError
--------------------------------------+------------------------------------
Reporter: bufke | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: Migrations | Version: 1.7-rc-1
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 timo):

* type: Uncategorized => Cleanup/optimization
* stage: Unreviewed => Accepted


--
Ticket URL: <https://code.djangoproject.com/ticket/22922#comment:3>

Django

unread,
Jul 7, 2014, 3:41:04 PM7/7/14
to django-...@googlegroups.com
#22922: Add a better error messsage or an FAQ entry for InvalidBasesError
--------------------------------------+------------------------------------
Reporter: bufke | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: Migrations | Version: 1.7-rc-1

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 CollinAnderson):

* cc: cmawebsite@… (added)


--
Ticket URL: <https://code.djangoproject.com/ticket/22922#comment:4>

Django

unread,
Jul 8, 2014, 3:07:00 AM7/8/14
to django-...@googlegroups.com
#22922: Add a better error messsage or an FAQ entry for InvalidBasesError
-------------------------------------+-------------------------------------
Reporter: bufke | Owner:
Type: | andrewgodwin
Cleanup/optimization | Status: assigned
Component: Migrations | Version: 1.7-rc-1
Severity: Release blocker | 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 andrewgodwin):

* status: new => assigned
* owner: nobody => andrewgodwin
* severity: Normal => Release blocker


Comment:

Promoting to release blocker so we don't get more tickets like #22965.

--
Ticket URL: <https://code.djangoproject.com/ticket/22922#comment:5>

Django

unread,
Jul 10, 2014, 2:58:31 AM7/10/14
to django-...@googlegroups.com
#22922: Add a better error messsage or an FAQ entry for InvalidBasesError
-------------------------------------+-------------------------------------
Reporter: bufke | Owner:
Type: | andrewgodwin
Cleanup/optimization | Status: closed
Component: Migrations | Version: 1.7-rc-1
Severity: Release blocker | Resolution: fixed

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 Andrew Godwin <andrew@…>):

* status: assigned => closed
* resolution: => fixed


Comment:

In [changeset:"b02abd688a60e2dedf607e34d2cc97aca8d1c2b5"]:
{{{
#!CommitTicketReference repository=""
revision="b02abd688a60e2dedf607e34d2cc97aca8d1c2b5"
Fixed #22922: Better error message for InvalidBasesError.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/22922#comment:6>

Django

unread,
Jul 10, 2014, 2:59:05 AM7/10/14
to django-...@googlegroups.com
#22922: Add a better error messsage or an FAQ entry for InvalidBasesError
-------------------------------------+-------------------------------------
Reporter: bufke | Owner:
Type: | andrewgodwin
Cleanup/optimization | Status: closed
Component: Migrations | Version: 1.7-rc-1

Severity: Release blocker | Resolution: fixed
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Andrew Godwin <andrew@…>):

In [changeset:"23ff98888e5c183b299f29ea651c9b545ef02807"]:
{{{
#!CommitTicketReference repository=""
revision="23ff98888e5c183b299f29ea651c9b545ef02807"
[1.7.x] Fixed #22922: Better error message for InvalidBasesError.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/22922#comment:7>

Django

unread,
Jul 23, 2014, 4:55:14 AM7/23/14
to django-...@googlegroups.com
#22922: Add a better error messsage or an FAQ entry for InvalidBasesError
-------------------------------------+-------------------------------------
Reporter: bufke | Owner:
Type: | andrewgodwin
Cleanup/optimization | Status: closed
Component: Migrations | Version: 1.7-rc-1

Severity: Release blocker | Resolution: fixed
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by magopian):

I'd like to reopen this, as I believe the error message in its current
state isn't very useful.
However, I'm not sure it's a good idea to reopen it, as this ticket is a
release blocker, and an "even better" error message maybe isn't that
important ;)

Here's an example output:

{{{


Cannot resolve bases for [<django.db.migrations.state.ModelState object at

0x7fd8e82f45d0>, <django.db.migrations.state.ModelState object at
0x109b8e69f476>]
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
}}}

I think it would be much more useful to have the model names for which the
bases could not be resolved, eg:

{{{['foo.Bar', 'baz.Cruux']}}}

A proposed modification would be to pass in
{{{['{}.{}'.format(ms.app_label, ms.name) for ms in
new_unrendered_models]}}} instead of simply {{{new_unrendered_models}}}.

As a side note, I'm not sure the space in front of " in an app" should be
there, as it's just after a line-jump, it could (should?) be removed (just
nitpicking ;).

--
Ticket URL: <https://code.djangoproject.com/ticket/22922#comment:8>

Django

unread,
Jul 29, 2014, 12:28:54 PM7/29/14
to django-...@googlegroups.com
#22922: Add a better error messsage or an FAQ entry for InvalidBasesError
-------------------------------------+-------------------------------------
Reporter: bufke | Owner:
Type: | andrewgodwin
Cleanup/optimization | Status: closed
Component: Migrations | Version: 1.7-rc-1
Severity: Release blocker | Resolution: needsinfo

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 spam@…):

* resolution: fixed => needsinfo


Comment:

I have analog example.Solved with remove from class Meta attribute
'abstract=True' in one is many classes (Sorry for my English,this is not
my native language =) )

--
Ticket URL: <https://code.djangoproject.com/ticket/22922#comment:9>

Django

unread,
Jul 29, 2014, 1:07:49 PM7/29/14
to django-...@googlegroups.com
#22922: Add a better error messsage or an FAQ entry for InvalidBasesError
-------------------------------------+-------------------------------------
Reporter: bufke | Owner:
Type: | andrewgodwin
Cleanup/optimization | Status: closed
Component: Migrations | Version: 1.7-rc-1
Severity: Release blocker | Resolution: fixed

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 charettes):

* resolution: needsinfo => fixed


Comment:

From what I understand you might be hitting a completely different issue.

Please don't re-open fixed tickets but open a new one with a detailed
report.

--
Ticket URL: <https://code.djangoproject.com/ticket/22922#comment:10>

Reply all
Reply to author
Forward
0 new messages