#23008 closed Bug (fixed)
Migrations depending on django.contrib.auth with custom User model fail
Reported by: | Ilya Semenov | Owned by: | nobody |
---|---|---|---|
Component: | Migrations | Version: | 1.7-rc-1 |
Severity: | Release blocker | Keywords: | |
Cc: | Andrew Godwin, Florian Apolloner | Triage Stage: | Accepted |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
Steps to reproduce:
- Create a new project and the new app
accounts
- Create the model
accounts.User
: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'
- Edit settings.py and set
AUTH_USER_MODEL = 'accounts.User'
- 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
.)
Change History (7)
comment:1 by , 10 years ago
Triage Stage: | Unreviewed → Accepted |
---|---|
Type: | Uncategorized → Bug |
comment:4 by , 10 years ago
Cc: | added |
---|
This seems to be caused by the fact that we have '__last__'
and '__latest__'
. (Changing the file to '__latest__'
makes migrate work fine). @andrew: Which of the two did you intend in the beginning?
comment:5 by , 10 years ago
Yeah, it's meant to be __latest__
, error on my part in the fix for the previous bug. Will fix it tonight if nobody gets there first.
comment:6 by , 10 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
makemigrations
works fine for me, it's not untilmigrate
that I get the error.