aboutsummaryrefslogtreecommitdiffstats
path: root/rest_framework/throttling.py
diff options
context:
space:
mode:
authorKaptian2015-02-05 13:27:26 -0800
committerKaptian2015-02-05 13:27:26 -0800
commitfffde8a63be7660e716672c500f0f2bd66c7d345 (patch)
tree9c1679e2abb8a675e79c97527b495f9e51daa561 /rest_framework/throttling.py
parent3b008245605d608e6a21d46f35994b8dc6bc12ed (diff)
downloaddjango-rest-framework-fffde8a63be7660e716672c500f0f2bd66c7d345.tar.bz2
Update throttling.py
Use pk pseudo attribute for identifying the user (in case the user model is not the default and has a different column name for the unique id)
Diffstat (limited to 'rest_framework/throttling.py')
-rw-r--r--rest_framework/throttling.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/rest_framework/throttling.py b/rest_framework/throttling.py
index 0f10136d..261fc246 100644
--- a/rest_framework/throttling.py
+++ b/rest_framework/throttling.py
@@ -191,7 +191,7 @@ class UserRateThrottle(SimpleRateThrottle):
def get_cache_key(self, request, view):
if request.user.is_authenticated():
- ident = request.user.id
+ ident = request.user.pk
else:
ident = self.get_ident(request)
@@ -239,7 +239,7 @@ class ScopedRateThrottle(SimpleRateThrottle):
with the '.throttle_scope` property of the view.
"""
if request.user.is_authenticated():
- ident = request.user.id
+ ident = request.user.pk
else:
ident = self.get_ident(request)