#24038 closed Bug (wontfix)
Django won't add dependencies to existing migrations
Reported by: | Esteban C Borsani | Owned by: | nobody |
---|---|---|---|
Component: | Migrations | Version: | 1.7 |
Severity: | Normal | Keywords: | Migrations AUTH_USER_MODEL |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
I've this app that uses a custom user model. I've created initial migrations. Anyone interested in replacing/extending my custom user model has to set AUTH_USER_MODEL
to their own custom user model that inherits from my abstract user model.
When running ./manage migrate
it fails with:
Running migrations: Applying spirit.0001_initial...Traceback (most recent call last): File "C:\Users\Admin\PycharmProjects\VEnv\Spirit-gh34\lib\site-packages\django\apps\registry.py", line 148, in get_app_config return self.app_configs[app_label] KeyError: 'myuserapp'
After adding ('myuserapp', '0001_initial'),
to spirit.0001_initial
dependencies list, everything works as expected.
To fix this, django should be able to add dependencies to existing migrations.
Change History (3)
comment:1 by , 10 years ago
Summary: | Migrations won't add dependencies to existing migrations → Django won't add dependencies to existing migrations |
---|
follow-up: 3 comment:2 by , 10 years ago
Resolution: | → wontfix |
---|---|
Status: | new → closed |
comment:3 by , 10 years ago
Replying to MarkusH:
It is impossible to rewrite migration files. They might contain custom code.
I thought so, thanks! Happy holidays.
It is impossible to rewrite migration files. They might contain custom code.
Furthermore you are using an internal Django API (swappable models) that isn't supported except for the User model in migrations. Apart from that, your settings.AUTH_USER_MODEL is used by two models (contrib.auth and your app) which is never going to work, if I'm not completely mistaken.
I recommend to have a look at the docs on how to extend the user model:https://docs.djangoproject.com/en/1.7/topics/auth/customizing/#substituting-a-custom-user-model