#24506: Proxying User model creates an invalid migration
-------------------------------------+-------------------------------------
     Reporter:  tinloaf              |                    Owner:
                                     |  marcofucci
         Type:  Bug                  |                   Status:  new
    Component:  Database layer       |                  Version:  1.8
  (models, ORM)                      |
     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
-------------------------------------+-------------------------------------

Comment (by Ernest0x):

 The traceback occurs when rendering model states:

 {{{
 Operations to perform:
   Synchronize unmigrated apps: rest_framework, django_python3_ldap,
 debug_toolbar, messages, staticfiles
   Apply all migrations: contenttypes, users, issues, ...
 Synchronizing apps without migrations:
   Creating tables...
     Running deferred SQL...
   Installing custom SQL...
 Running migrations:
   Rendering model states...Traceback (most recent call last):
   File "/path/to/virtualenv/lib/python3.4/site-
 packages/django/apps/config.py", line 159, in get_model
     return self.models[model_name.lower()]
 KeyError: 'group'

 During handling of the above exception, another exception occurred:

 Traceback (most recent call last):
   File "/path/to/virtualenv/lib/python3.4/site-
 packages/django/db/migrations/state.py", line 238, in __init__
     model = self.get_model(lookup_model[0], lookup_model[1])
   File "/path/to/virtualenv/lib/python3.4/site-
 packages/django/apps/registry.py", line 202, in get_model
     return self.get_app_config(app_label).get_model(model_name.lower())
   File "/path/to/virtualenv/lib/python3.4/site-
 packages/django/apps/config.py", line 162, in get_model
     "App '%s' doesn't have a '%s' model." % (self.label, model_name))
 LookupError: App 'users' doesn't have a 'group' model.

 During handling of the above exception, another exception occurred:

 Traceback (most recent call last):
   File "manage.py", line 10, in <module>
     execute_from_command_line(sys.argv)
   File "/path/to/virtualenv/lib/python3.4/site-
 packages/django/core/management/__init__.py", line 338, in
 execute_from_command_line
     utility.execute()
   File "/path/to/virtualenv/lib/python3.4/site-
 packages/django/core/management/__init__.py", line 330, in execute
     self.fetch_command(subcommand).run_from_argv(self.argv)
   File "/path/to/virtualenv/lib/python3.4/site-
 packages/django/core/management/base.py", line 390, in run_from_argv
     self.execute(*args, **cmd_options)
   File "/path/to/virtualenv/lib/python3.4/site-
 packages/django/core/management/base.py", line 441, in execute
     output = self.handle(*args, **options)
   File "/path/to/virtualenv/lib/python3.4/site-
 packages/django/core/management/commands/migrate.py", line 221, in handle
     executor.migrate(targets, plan, fake=fake, fake_initial=fake_initial)
   File "/path/to/virtualenv/lib/python3.4/site-
 packages/django/db/migrations/executor.py", line 100, in migrate
     state.apps  # Render all real_apps -- performance critical
   File "/path/to/virtualenv/lib/python3.4/site-
 packages/django/utils/functional.py", line 60, in __get__
     res = instance.__dict__[self.name] = self.func(instance)
   File "/path/to/virtualenv/lib/python3.4/site-
 packages/django/db/migrations/state.py", line 166, in apps
     return StateApps(self.real_apps, self.models)
   File "/path/to/virtualenv/lib/python3.4/site-
 packages/django/db/migrations/state.py", line 248, in __init__
     raise ValueError(msg.format(field=operations[0][1],
 model=lookup_model))
 ValueError: Lookup failed for model referenced by field
 issues.SomeModel.group: users.Group
 }}}

--
Ticket URL: <https://code.djangoproject.com/ticket/24506#comment:6>
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/065.42d4b2e146ab78ab1aaf855817016759%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to