Skip to content

Commit 24372ec

Browse files
committed
Merge pull request #2524 from Kaptian/patch-1
Allow non-standard User models with Throttling
2 parents 3b00824 + fffde8a commit 24372ec

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

rest_framework/throttling.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ class UserRateThrottle(SimpleRateThrottle):
191191

192192
def get_cache_key(self, request, view):
193193
if request.user.is_authenticated():
194-
ident = request.user.id
194+
ident = request.user.pk
195195
else:
196196
ident = self.get_ident(request)
197197

@@ -239,7 +239,7 @@ def get_cache_key(self, request, view):
239239
with the '.throttle_scope` property of the view.
240240
"""
241241
if request.user.is_authenticated():
242-
ident = request.user.id
242+
ident = request.user.pk
243243
else:
244244
ident = self.get_ident(request)
245245

0 commit comments

Comments
 (0)