aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--rest_framework/decorators.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/rest_framework/decorators.py b/rest_framework/decorators.py
index 325435b3..a68227c1 100644
--- a/rest_framework/decorators.py
+++ b/rest_framework/decorators.py
@@ -109,10 +109,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.
"""
+ if methods is None:
+ methods = ['get']
def decorator(func):
func.bind_to_methods = methods
func.detail = True
@@ -121,10 +123,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.
"""
+ if methods is None:
+ methods = ['get']
def decorator(func):
func.bind_to_methods = methods
func.detail = False