Currently I\'m using Django 1.11 and Python 3.6. I\'m attempting to create a custom user model with a new application that authenticates with LDAP, but i\'m greeted with th
This is caused by your settings.AUTH_USER_MODEL
having changed to a model that does not exist when migrations are being computed.
A slightly hacky way to fix this without data loss, if you're migrating from auth.User to custom.User is to add a "virtual" (separate database and state) minimal model (that is, only the ID field, to allow for foreign keys) according to the new User model in the very initial migration, so future migrations have this reference:
operations=[
migrations.SeparateDatabaseAndState(
state_operations=[
migrations.CreateModel(
name="User",
fields=[
(
"id",
models.AutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
)
],
options={"db_table": "auth_user"},
managers=[("objects", UserManager())],
)
]
),
# ... other migrations