#22965: migrations break subclasses of User
---------------------------------+----------------------
     Reporter:  CollinAnderson   |      Owner:  nobody
         Type:  Bug              |     Status:  new
    Component:  Migrations       |    Version:  1.7-rc-1
     Severity:  Release blocker  |   Keywords:
 Triage Stage:  Unreviewed       |  Has patch:  0
Easy pickings:  0                |      UI/UX:  0
---------------------------------+----------------------
 Unmigrated app in a project not swapping out the `User` model:
 {{{
 from django.contrib.auth.models import User
 from django.db import models


 class UserProfile(User):
     bio = models.TextField()
 }}}
 `syncdb` and `migrate` give this error on latest `1.7` and `master`:

 {{{
 ~/usersubclasstest$ rm db.sqlite3; PYTHONPATH=../django1.7 ./manage.py
 syncdb
 Operations to perform:
   Synchronize unmigrated apps: account
   Apply all migrations: admin, contenttypes, auth, sessions
 Synchronizing apps without migrations:
   Creating tables...
     Creating table account_userprofile
   Installing custom SQL...
   Installing indexes...
 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 "/home/collin/django1.7/django/core/management/__init__.py", line
 385, in execute_from_command_line
     utility.execute()
   File "/home/collin/django1.7/django/core/management/__init__.py", line
 377, in execute
     self.fetch_command(subcommand).run_from_argv(self.argv)
   File "/home/collin/django1.7/django/core/management/base.py", line 288,
 in run_from_argv
     self.execute(*args, **options.__dict__)
   File "/home/collin/django1.7/django/core/management/base.py", line 337,
 in execute
     output = self.handle(*args, **options)
   File "/home/collin/django1.7/django/core/management/base.py", line 532,
 in handle
     return self.handle_noargs(**options)
   File "/home/collin/django1.7/django/core/management/commands/syncdb.py",
 line 27, in handle_noargs
     call_command("migrate", **options)
   File "/home/collin/django1.7/django/core/management/__init__.py", line
 115, in call_command
     return klass.execute(*args, **defaults)
   File "/home/collin/django1.7/django/core/management/base.py", line 337,
 in execute
     output = self.handle(*args, **options)
   File
 "/home/collin/django1.7/django/core/management/commands/migrate.py", line
 160, in handle
     executor.migrate(targets, plan, fake=options.get("fake", False))
   File "/home/collin/django1.7/django/db/migrations/executor.py", line 62,
 in migrate
     self.apply_migration(migration, fake=fake)
   File "/home/collin/django1.7/django/db/migrations/executor.py", line 90,
 in apply_migration
     if self.detect_soft_applied(migration):
   File "/home/collin/django1.7/django/db/migrations/executor.py", line
 134, in detect_soft_applied
     apps = project_state.render()
   File "/home/collin/django1.7/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
 [<ModelState: 'account.UserProfile'>]

 }}}

 Initializing the database using `1.6` `syncdb` doesn't help either (unless
 you use --fake).

 I have a
 [https://github.com/collinanderson/usersubclasstest/commits/master minimal
 project that reproduces the error on github].

 Feel free to remove the release blocker status if what I'm doing isn't
 supported. If it's not supported, we should have a more helpful error
 message.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/22965>
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/057.574616610f2ea8e231f0075bc0269f10%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to