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
3b008245
Commit
3b008245
authored
Feb 04, 2015
by
Tom Christie
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2518 from longhotsummer/patch-1
FIX: Don't default to list in method args
parents
d21617ff
e13d2af1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
4 deletions
+7
-4
rest_framework/decorators.py
+7
-4
No files found.
rest_framework/decorators.py
View file @
3b008245
...
...
@@ -18,8 +18,7 @@ def api_view(http_method_names=None):
Decorator that converts a function-based view into an APIView subclass.
Takes a list of allowed methods for the view as an argument.
"""
if
http_method_names
is
None
:
http_method_names
=
[
'GET'
]
http_method_names
=
[
'GET'
]
if
(
http_method_names
is
None
)
else
http_method_names
def
decorator
(
func
):
...
...
@@ -109,10 +108,12 @@ def permission_classes(permission_classes):
return
decorator
def
detail_route
(
methods
=
[
'get'
]
,
**
kwargs
):
def
detail_route
(
methods
=
None
,
**
kwargs
):
"""
Used to mark a method on a ViewSet that should be routed for detail requests.
"""
methods
=
[
'get'
]
if
(
methods
is
None
)
else
methods
def
decorator
(
func
):
func
.
bind_to_methods
=
methods
func
.
detail
=
True
...
...
@@ -121,10 +122,12 @@ def detail_route(methods=['get'], **kwargs):
return
decorator
def
list_route
(
methods
=
[
'get'
]
,
**
kwargs
):
def
list_route
(
methods
=
None
,
**
kwargs
):
"""
Used to mark a method on a ViewSet that should be routed for list requests.
"""
methods
=
[
'get'
]
if
(
methods
is
None
)
else
methods
def
decorator
(
func
):
func
.
bind_to_methods
=
methods
func
.
detail
=
False
...
...
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