File tree Expand file tree Collapse file tree 1 file changed +5
-6
lines changed Expand file tree Collapse file tree 1 file changed +5
-6
lines changed Original file line number Diff line number Diff line change @@ -18,8 +18,7 @@ def api_view(http_method_names=None):
18
18
Decorator that converts a function-based view into an APIView subclass.
19
19
Takes a list of allowed methods for the view as an argument.
20
20
"""
21
- if http_method_names is None :
22
- http_method_names = ['GET' ]
21
+ http_method_names = ['GET' ] if http_method_names is None else http_method_names
23
22
24
23
def decorator (func ):
25
24
@@ -113,8 +112,8 @@ def detail_route(methods=None, **kwargs):
113
112
"""
114
113
Used to mark a method on a ViewSet that should be routed for detail requests.
115
114
"""
116
- if methods is None :
117
- methods = [ 'get' ]
115
+ methods = [ 'get' ] if methods is None else methods
116
+
118
117
def decorator (func ):
119
118
func .bind_to_methods = methods
120
119
func .detail = True
@@ -127,8 +126,8 @@ def list_route(methods=None, **kwargs):
127
126
"""
128
127
Used to mark a method on a ViewSet that should be routed for list requests.
129
128
"""
130
- if methods is None :
131
- methods = [ 'get' ]
129
+ methods = [ 'get' ] if methods is None else methods
130
+
132
131
def decorator (func ):
133
132
func .bind_to_methods = methods
134
133
func .detail = False
You can’t perform that action at this time.
0 commit comments