File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Expand file tree Collapse file tree 1 file changed +7
-4
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
@@ -109,10 +108,12 @@ def decorator(func):
109
108
return decorator
110
109
111
110
112
- def detail_route (methods = [ 'get' ] , ** kwargs ):
111
+ 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
"""
115
+ methods = ['get' ] if (methods is None ) else methods
116
+
116
117
def decorator (func ):
117
118
func .bind_to_methods = methods
118
119
func .detail = True
@@ -121,10 +122,12 @@ def decorator(func):
121
122
return decorator
122
123
123
124
124
- def list_route (methods = [ 'get' ] , ** kwargs ):
125
+ def list_route (methods = None , ** kwargs ):
125
126
"""
126
127
Used to mark a method on a ViewSet that should be routed for list requests.
127
128
"""
129
+ methods = ['get' ] if (methods is None ) else methods
130
+
128
131
def decorator (func ):
129
132
func .bind_to_methods = methods
130
133
func .detail = False
You can’t perform that action at this time.
0 commit comments