﻿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
23008	Migrations depending on django.contrib.auth with custom User model fail	Ilya Semenov	nobody	"Steps to reproduce:
1. Create a new project and the new app `accounts`
2. Create the model `accounts.User`:
{{{#!python
from django.contrib.auth import models as auth_models
from django.db import models

class User(auth_models.AbstractBaseUser, auth_models.PermissionsMixin):
        name = models.CharField(max_length=255, unique=True)
        USERNAME_FIELD = 'name'
}}}
3. Edit settings.py and set `AUTH_USER_MODEL = 'accounts.User'`
4. Run `manage.py makemigrations accounts`. It will crash:
{{{
...
  File ""/Users/semenov/work/migrtest/venv/src/django/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'auth', u'__last__')""
}}}

This started to happen 2 days ago, I bisected the cause to aba75e73db6a0baca1b721698ca24f026bb4a745 (the fix for #22970). Previously, the migration dependencies were set to `[('auth', '__first__')]` which worked fine. (I realize that `__last__` makes more sense, so this is not about reverting the fix but rather making `__last__` to work on `django.contrib.auth.migrations`.)"	Bug	closed	Migrations	1.7-rc-1	Release blocker	fixed		Andrew Godwin Florian Apolloner	Accepted	0	0	0	0	0	0
