aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Maillard2014-11-28 21:12:13 +0100
committerMartin Maillard2014-11-28 21:12:27 +0100
commit85c96bb574b57e5889cd54b98c0320f8dd090e31 (patch)
tree3b55da73f108d156b983bf6e0eab97874b286033
parentcaf1de3b88c6644b55065abea255f64a81e800c0 (diff)
downloaddjango-rest-framework-85c96bb574b57e5889cd54b98c0320f8dd090e31.tar.bz2
Set user on wrapped request
-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 d7e74674..dcf63abe 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()