mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-02-03 13:14:30 +03:00
Use REST framework request parsing when accessing old-style .POST
This commit is contained in:
parent
bb555e6e5e
commit
d587ad1021
|
@ -117,9 +117,8 @@ class SessionAuthentication(BaseAuthentication):
|
||||||
Otherwise returns `None`.
|
Otherwise returns `None`.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# Get the underlying HttpRequest object
|
# Get the session-based user from the underlying HttpRequest object
|
||||||
request = request._request
|
user = getattr(request._request, 'user', None)
|
||||||
user = getattr(request, 'user', None)
|
|
||||||
|
|
||||||
# Unauthenticated, CSRF validation not required
|
# Unauthenticated, CSRF validation not required
|
||||||
if not user or not user.is_active:
|
if not user or not user.is_active:
|
||||||
|
|
|
@ -365,6 +365,15 @@ class Request(object):
|
||||||
'since version 3.0, and has been fully removed as of version 3.2.'
|
'since version 3.0, and has been fully removed as of version 3.2.'
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def POST(self):
|
||||||
|
# Ensure that request.POST uses our request parsing.
|
||||||
|
if not _hasattr(self, '_data'):
|
||||||
|
self._load_data_and_files()
|
||||||
|
if is_form_media_type(self.content_type):
|
||||||
|
return self.data
|
||||||
|
return QueryDict('', encoding=self._request._encoding)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def FILES(self):
|
def FILES(self):
|
||||||
# Leave this one alone for backwards compat with Django's request.FILES
|
# Leave this one alone for backwards compat with Django's request.FILES
|
||||||
|
|
Loading…
Reference in New Issue
Block a user