aboutsummaryrefslogtreecommitdiffstats
path: root/rest_framework/request.py
diff options
context:
space:
mode:
authorTom Christie2014-12-17 13:12:01 +0000
committerTom Christie2014-12-17 13:12:01 +0000
commit7fbf5b0e6bf49a7f2761229b1576027d39e56be4 (patch)
tree30be2bad8ba2447601d7436082d2297d3af166a5 /rest_framework/request.py
parentd872c8e2e7f3e5c3a4d8d648361394858f68f5d6 (diff)
parenta68e78bd0b5174d2c8a40497d3d5842f66c65a34 (diff)
downloaddjango-rest-framework-7fbf5b0e6bf49a7f2761229b1576027d39e56be4.tar.bz2
Merge pull request #2155 from martinmaillard/set-user-on-wrapped-request
Set authenticated user on wrapped request
Diffstat (limited to 'rest_framework/request.py')
-rw-r--r--rest_framework/request.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/rest_framework/request.py b/rest_framework/request.py
index 20e049ed..8248cbd4 100644
--- a/rest_framework/request.py
+++ b/rest_framework/request.py
@@ -277,8 +277,11 @@ class Request(object):
Sets the user on the current request. This is necessary to maintain
compatibility with django.contrib.auth where the user property is
set in the login and logout functions.
+
+ Sets the user on the wrapped original request as well.
"""
self._user = value
+ self._request.user = value
@property
def auth(self):
@@ -456,7 +459,7 @@ class Request(object):
if user_auth_tuple is not None:
self._authenticator = authenticator
- self._user, self._auth = user_auth_tuple
+ self.user, self._auth = user_auth_tuple
return
self._not_authenticated()
@@ -471,9 +474,9 @@ class Request(object):
self._authenticator = None
if api_settings.UNAUTHENTICATED_USER:
- self._user = api_settings.UNAUTHENTICATED_USER()
+ self.user = api_settings.UNAUTHENTICATED_USER()
else:
- self._user = None
+ self.user = None
if api_settings.UNAUTHENTICATED_TOKEN:
self._auth = api_settings.UNAUTHENTICATED_TOKEN()