Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)
  • Loading branch information
Kaptian committed Feb 5, 2015
commit fffde8a63be7660e716672c500f0f2bd66c7d345
4 changes: 2 additions & 2 deletions rest_framework/throttling.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -239,7 +239,7 @@ def get_cache_key(self, request, view):
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)

Expand Down