Skip to content

Fix authtoken.TokenProxy error when not installed in Django apps #7584

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

Conversation

terencehonles
Copy link
Contributor

@terencehonles terencehonles commented Oct 8, 2020

Description

I fixed this issue before I realized it was already reported #7442 and another fix was proposed in #7571. I think this solution is probably better than making the TokenProxy become an abstract model and no longer a proxy since an error about the model being abstract might be more confusing than an ImproperlyConfigured error. This might also be something to add/change in the Token model as that might be more likely where someone would run into creation of an abstract model.

fixes: #7442

@terencehonles terencehonles force-pushed the fix-TokenProxy-when-not-authtoken-not-installed branch from bc1ee84 to befb3a2 Compare October 8, 2020 16:35
@property
def pk(self):
return self.user.pk
if 'rest_framework.authtoken' in settings.INSTALLED_APPS:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The token model could also be moved into this block and use the same pattern as I did for TokenProxy

@terencehonles terencehonles force-pushed the fix-TokenProxy-when-not-authtoken-not-installed branch from befb3a2 to 5777fb5 Compare October 8, 2020 18:03
@tomchristie
Copy link
Member

tomchristie commented Oct 9, 2020

Let's roll with #7571

@tomchristie tomchristie closed this Oct 9, 2020
@terencehonles terencehonles deleted the fix-TokenProxy-when-not-authtoken-not-installed branch October 9, 2020 18:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TokenProxy can't be proxy model when Token is abstract model
2 participants