Don't hit db to access user_id in TokenProxy (#7852)

This commit is contained in:
Anton Zaslavskiy 2021-03-19 14:46:09 +03:00 committed by GitHub
parent 67ebdd32cd
commit b25ac6c5e3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -46,7 +46,7 @@ class TokenProxy(Token):
""" """
@property @property
def pk(self): def pk(self):
return self.user.pk return self.user_id
class Meta: class Meta:
proxy = 'rest_framework.authtoken' in settings.INSTALLED_APPS proxy = 'rest_framework.authtoken' in settings.INSTALLED_APPS