aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXavier Ordoquy2015-02-05 23:02:59 +0100
committerXavier Ordoquy2015-02-05 23:02:59 +0100
commit24372ec7787b1b84e46f197b2559011331e2988c (patch)
tree9c1679e2abb8a675e79c97527b495f9e51daa561
parent3b008245605d608e6a21d46f35994b8dc6bc12ed (diff)
parentfffde8a63be7660e716672c500f0f2bd66c7d345 (diff)
downloaddjango-rest-framework-24372ec7787b1b84e46f197b2559011331e2988c.tar.bz2
Merge pull request #2524 from Kaptian/patch-1
Allow non-standard User models with Throttling
-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)