-
-
Notifications
You must be signed in to change notification settings - Fork 6.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Re-add conditional abstract setting to Token model #3858
Comments
Should be fixed by #3785 |
Unfortunately, that's the exact commit that introduces the breakage. The delayed import doesn't seem to help. I haven't been able to figure out why. |
When I was experimenting and trying to figure out how to work around this, I even deleted the entire |
(We're on Django 1.8.) |
Do you have some sample project to reproduce the issue ? |
Not at the moment (it's a private project). I'll try to get some time to make one. I imagine it would involve:
I don't know if the migration ordering issue will occur for the test project - it depends on whether |
Now that I read this again, I think I get the issue and indeed the Token should be left abstract if the app isn't in the INSTALLED_APPS. |
👍 Thanks :) |
Yup, that's #3860 |
@adam-thomas thanks for pointing this to our attention. |
Thank you @xordoquy :) |
And, most welcome! Glad to help! |
👍 |
When attempting to use a custom model instead of DRF's built-in
Token
, Django tries very hard to include theToken
model even ifrest_framework.authtoken
isn't inINSTALLED_APPS
. Attempting to run migrations on a fresh database will explode with a missing user model error, and an already-set-up database will have aToken
table added to it (which also means the user model gets an unwantedauth_token
OneToOne
field on it).I believe a simple fix for this behaviour is to reinstate the
Meta
abstract
setting in theToken
model. I spent a day or so digging for other ways to avoid usingToken
in the project I was working on and couldn't find anything, but there may also be other fixes.The text was updated successfully, but these errors were encountered: