From b25ac6c5e36403f62b13163a0190eaa48b586c47 Mon Sep 17 00:00:00 2001 From: Anton Zaslavskiy Date: Fri, 19 Mar 2021 14:46:09 +0300 Subject: [PATCH] Don't hit db to access user_id in TokenProxy (#7852) --- rest_framework/authtoken/models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rest_framework/authtoken/models.py b/rest_framework/authtoken/models.py index 540049295..5a143d936 100644 --- a/rest_framework/authtoken/models.py +++ b/rest_framework/authtoken/models.py @@ -46,7 +46,7 @@ class TokenProxy(Token): """ @property def pk(self): - return self.user.pk + return self.user_id class Meta: proxy = 'rest_framework.authtoken' in settings.INSTALLED_APPS