﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
23021	"Cannot migrate: KeyError: u""Dependency references nonexistent parent node (u'contenttypes', u'__last__')"""	artscoop	nobody	"Hello all,
I found a migration bug I cannot resolve. I wanted to create an initial migration for an app.
I called ""makemigrations content"". Everything ok (was broken in 1.7 RC1 but fixed in stable/1.7.x).
Then I tried to ""migrate content --fake"". Here's the whole output:

{{{
    Traceback (most recent call last):
      File ""/home/artscoop/virtualenv/project/one/manage.py"", line 8, in <module>
        execute_from_command_line(sys.argv)
      File ""/home/artscoop/virtualenv/project/local/lib/python2.7/site-packages/django/core/management/__init__.py"", line 385, in execute_from_command_line
        utility.execute()
      File ""/home/artscoop/virtualenv/project/local/lib/python2.7/site-packages/django/core/management/__init__.py"", line 377, in execute
        self.fetch_command(subcommand).run_from_argv(self.argv)
      File ""/home/artscoop/virtualenv/project/local/lib/python2.7/site-packages/django/core/management/base.py"", line 288, in run_from_argv
        self.execute(*args, **options.__dict__)
      File ""/home/artscoop/virtualenv/project/local/lib/python2.7/site-packages/django/core/management/base.py"", line 337, in execute
        output = self.handle(*args, **options)
      File ""/home/artscoop/virtualenv/project/local/lib/python2.7/site-packages/django/core/management/commands/migrate.py"", line 63, in handle
        executor = MigrationExecutor(connection, self.migration_progress_callback)
      File ""/home/artscoop/virtualenv/project/local/lib/python2.7/site-packages/django/db/migrations/executor.py"", line 16, in __init__
        self.loader = MigrationLoader(self.connection)
      File ""/home/artscoop/virtualenv/project/local/lib/python2.7/site-packages/django/db/migrations/loader.py"", line 48, in __init__
        self.build_graph()
      File ""/home/artscoop/virtualenv/project/local/lib/python2.7/site-packages/django/db/migrations/loader.py"", line 241, in build_graph
        self.graph.add_dependency(key, parent)
      File ""/home/artscoop/virtualenv/project/local/lib/python2.7/site-packages/django/db/migrations/graph.py"", line 42, in add_dependency
        raise KeyError(""Dependency references nonexistent parent node %r"" % (parent,))
    KeyError: u""Dependency references nonexistent parent node (u'contenttypes', u'__last__')""
}}}

On 13 models, 4 have a generic foreign key (a ""contenttypes.ContentType"" foreign key)."	Bug	closed	Migrations	1.7-rc-1	Release blocker	duplicate			Unreviewed	0	0	0	0	0	0
