#24225: KeyError when migrating in 1.8a1/master@728b6fd (does not occur in
1.7.3)
---------------------------------+-------------------------------------
Reporter: hheimbuerger | Owner: nobody
Type: Bug | Status: new
Component: Migrations | Version: 1.8alpha1
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
---------------------------------+-------------------------------------
Comment (by hheimbuerger):
Claude inspired me to try again, and I think I managed to create a fairly
minimal reproduction case, which is now attached.
Run `python manage.py migrate`.
Result on Django 1.7.4:
{{{
Operations to perform:
Apply all migrations: admin, contenttypes, myapp, auth, sessions
Running migrations:
Applying contenttypes.0001_initial... OK
Applying auth.0001_initial... OK
Applying admin.0001_initial... OK
Applying myapp.0001_initial... OK
Applying myapp.0002_a... OK
Applying myapp.0003_a... OK
Applying myapp.0004_a... OK
Applying myapp.0002_b... OK
Applying myapp.0005_merge_a_and_b... OK
Applying sessions.0001_initial... OK
}}}
Result on Django master (from Jan 27):
{{{
Operations to perform:
Apply all migrations: admin, contenttypes, myapp, auth, sessions
Running migrations:
Rendering model states... DONE
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "d:\develop\django-trunk\django\core\management\__init__.py", line
330, in execute_from_command_line
utility.execute()
File "d:\develop\django-trunk\django\core\management\__init__.py", line
322, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "d:\develop\django-trunk\django\core\management\base.py", line 350,
in run_from_argv
self.execute(*args, **cmd_options)
File "d:\develop\django-trunk\django\core\management\base.py", line 401,
in execute
output = self.handle(*args, **options)
File "d:\develop\django-
trunk\django\core\management\commands\migrate.py", line 187, in handle
executor.migrate(targets, plan, fake=options.get("fake", False))
File "d:\develop\django-trunk\django\db\migrations\executor.py", line
89, in migrate
state = migration.mutate_state(state) # state is cloned inside
File "d:\develop\django-trunk\django\db\migrations\migration.py", line
78, in mutate_state
operation.state_forwards(self.app_label, new_state)
File "d:\develop\django-
trunk\django\db\migrations\operations\fields.py", line 50, in
state_forwards
state.reload_model(app_label, self.model_name_lower)
File "d:\develop\django-trunk\django\db\migrations\state.py", line 61,
in reload_model
self._reload_one_model(rel_model._meta.app_label,
rel_model._meta.model_name)
File "d:\develop\django-trunk\django\db\migrations\state.py", line 68,
in _reload_one_model
self.models[app_label, model_name].render(self.apps)
KeyError: ('myapp', 'somemodel')
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/24225#comment:4>
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/070.09a765f030fd5297739b984ff99ab71a%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.