#27168: "LookupError: App 'xxxxx' doesn't have a 'xxxxx' model" with custom 
table
name
----------------------------+--------------------------------------
     Reporter:  chagh       |                    Owner:  nobody
         Type:  Bug         |                   Status:  new
    Component:  Migrations  |                  Version:  1.8
     Severity:  Normal      |               Resolution:
     Keywords:  migration   |             Triage Stage:  Unreviewed
    Has patch:  0           |      Needs documentation:  0
  Needs tests:  0           |  Patch needs improvement:  0
Easy pickings:  0           |                    UI/UX:  0
----------------------------+--------------------------------------

Comment (by chagh):

 The original code is this:

 {{{
 def migrate_client_billing(apps, schema_editor):
     engagement_client_model = apps.get_model(
         app_label='engagement',
         model_name='EngagementClient')

     client_billing_model = apps.get_model(
         app_label='billing',
         model_name='ClientBilling')

     engagement_clients = engagement_client_model.objects.all()

     for engagement_client in engagement_clients:
         obj, created = client_billing_model.objects.get_or_create(
             engagement=engagement_client.engagement,
             client=engagement_client.client
         )
 }}}

 My teammate wasn't able to reproduce it either.

 My env is Python 2.7.11 with Django 1.8.12

 This is the stack trace:

 {{{
 Operations to perform:
   Apply all migrations: billing
 Running migrations:
   Rendering model states... DONE
   Applying billing.0003_create_missing_client_billing...Traceback (most
 recent call last):
   File "manage.py", line 12, in <module>
     execute_from_command_line(sys.argv)
   File "/home/user/project101/lib/python2.7/site-
 packages/django/core/management/__init__.py", line 354, in
 execute_from_command_line
     utility.execute()
   File "/home/user/project101/lib/python2.7/site-
 packages/django/core/management/__init__.py", line 346, in execute
     self.fetch_command(subcommand).run_from_argv(self.argv)
   File "/home/user/project101/lib/python2.7/site-
 packages/django/core/management/base.py", line 394, in run_from_argv
     self.execute(*args, **cmd_options)
   File "/home/user/project101/lib/python2.7/site-
 packages/django/core/management/base.py", line 445, in execute
     output = self.handle(*args, **options)
   File "/home/user/project101/lib/python2.7/site-
 packages/django/core/management/commands/migrate.py", line 222, in handle
     executor.migrate(targets, plan, fake=fake, fake_initial=fake_initial)
   File "/home/user/project101/lib/python2.7/site-
 packages/django/db/migrations/executor.py", line 110, in migrate
     self.apply_migration(states[migration], migration, fake=fake,
 fake_initial=fake_initial)
   File "/home/user/project101/lib/python2.7/site-
 packages/django/db/migrations/executor.py", line 148, in apply_migration
     state = migration.apply(state, schema_editor)
   File "/home/user/project101/lib/python2.7/site-
 packages/django/db/migrations/migration.py", line 112, in apply
     operation.database_forwards(self.app_label, schema_editor, old_state,
 project_state)
   File "/home/user/project101/lib/python2.7/site-
 packages/django/db/migrations/operations/special.py", line 183, in
 database_forwards
     self.code(from_state.apps, schema_editor)
   File
 
"/home/user/project101/project/billing/migrations/0003_create_missing_client_billing.py",
 line 15, in migrate_client_billing
     model_name='EngagementClient')
   File "/home/user/project101/lib/python2.7/site-
 packages/django/apps/registry.py", line 202, in get_model
     return self.get_app_config(app_label).get_model(model_name.lower())
   File "/home/user/project101/lib/python2.7/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 'engagement' doesn't have a 'engagementclient' model.
 }}}

--
Ticket URL: <https://code.djangoproject.com/ticket/27168#comment:3>
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/063.e3e53fc29dde7c738b1199f8aea41654%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to