Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
django-rest-framework
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
django-rest-framework
Commits
a9f1d99c
Commit
a9f1d99c
authored
Jul 16, 2015
by
Tom Christie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix 'metadata' action on viewsets. Closes #3158. Closes #3157. Closes #3115.
parent
6b08e97b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
7 deletions
+8
-7
rest_framework/viewsets.py
+8
-7
No files found.
rest_framework/viewsets.py
View file @
a9f1d99c
...
@@ -83,12 +83,6 @@ class ViewSetMixin(object):
...
@@ -83,12 +83,6 @@ class ViewSetMixin(object):
if
hasattr
(
self
,
'get'
)
and
not
hasattr
(
self
,
'head'
):
if
hasattr
(
self
,
'get'
)
and
not
hasattr
(
self
,
'head'
):
self
.
head
=
self
.
get
self
.
head
=
self
.
get
# Explicitly map `options` requests to an (implicit) action named
# 'metadata'. This action doesn't actually exist as a named method,
# because, unlike other methods, we always route to it.
if
hasattr
(
self
,
'options'
):
self
.
action_map
[
'options'
]
=
'metadata'
# And continue as usual
# And continue as usual
return
self
.
dispatch
(
request
,
*
args
,
**
kwargs
)
return
self
.
dispatch
(
request
,
*
args
,
**
kwargs
)
...
@@ -112,7 +106,14 @@ class ViewSetMixin(object):
...
@@ -112,7 +106,14 @@ class ViewSetMixin(object):
depending on the request method.
depending on the request method.
"""
"""
request
=
super
(
ViewSetMixin
,
self
)
.
initialize_request
(
request
,
*
args
,
**
kwargs
)
request
=
super
(
ViewSetMixin
,
self
)
.
initialize_request
(
request
,
*
args
,
**
kwargs
)
self
.
action
=
self
.
action_map
.
get
(
request
.
method
.
lower
())
method
=
request
.
method
.
lower
()
if
method
==
'options'
:
# This is a special case as we always provide handling for the
# options method in the base `View` class.
# Unlike the other explicitly defined actions, 'metadata' is implict.
self
.
action
=
'metadata'
else
:
self
.
action
=
self
.
action_map
.
get
(
method
)
return
request
return
request
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment