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
e3f8d06b
Commit
e3f8d06b
authored
Aug 15, 2016
by
Tom Christie
Committed by
GitHub
Aug 15, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Include .action attribute on viewsets when generating schemas (#4408)
parent
101fd290
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
0 deletions
+8
-0
rest_framework/schemas.py
+7
-0
tests/test_schemas.py
+1
-0
No files found.
rest_framework/schemas.py
View file @
e3f8d06b
...
@@ -79,6 +79,13 @@ class SchemaGenerator(object):
...
@@ -79,6 +79,13 @@ class SchemaGenerator(object):
view
.
kwargs
=
{}
view
.
kwargs
=
{}
view
.
format_kwarg
=
None
view
.
format_kwarg
=
None
actions
=
getattr
(
callback
,
'actions'
,
None
)
if
actions
is
not
None
:
if
method
==
'OPTIONS'
:
view
.
action
=
'metadata'
else
:
view
.
action
=
actions
.
get
(
method
.
lower
())
if
request
is
not
None
:
if
request
is
not
None
:
view
.
request
=
clone_request
(
request
,
method
)
view
.
request
=
clone_request
(
request
,
method
)
try
:
try
:
...
...
tests/test_schemas.py
View file @
e3f8d06b
...
@@ -49,6 +49,7 @@ class ExampleViewSet(ModelViewSet):
...
@@ -49,6 +49,7 @@ class ExampleViewSet(ModelViewSet):
def
get_serializer
(
self
,
*
args
,
**
kwargs
):
def
get_serializer
(
self
,
*
args
,
**
kwargs
):
assert
self
.
request
assert
self
.
request
assert
self
.
action
return
super
(
ExampleViewSet
,
self
)
.
get_serializer
(
*
args
,
**
kwargs
)
return
super
(
ExampleViewSet
,
self
)
.
get_serializer
(
*
args
,
**
kwargs
)
...
...
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