Skip to content

Commit 92ebeaa

Browse files
committed
Change decorator attribute name to url_path per suggestions
1 parent 6a095e9 commit 92ebeaa

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

rest_framework/routers.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -177,26 +177,26 @@ def get_routes(self, viewset):
177177
# Dynamic detail routes (@detail_route decorator)
178178
for httpmethods, methodname in detail_routes:
179179
method_kwargs = getattr(viewset, methodname).kwargs
180-
custom_method_name = method_kwargs.pop("custom_method_name", None) or methodname
180+
url_path = method_kwargs.pop("url_path", None) or methodname
181181
initkwargs = route.initkwargs.copy()
182182
initkwargs.update(method_kwargs)
183183
ret.append(Route(
184-
url=replace_methodname(route.url, custom_method_name),
184+
url=replace_methodname(route.url, url_path),
185185
mapping=dict((httpmethod, methodname) for httpmethod in httpmethods),
186-
name=replace_methodname(route.name, custom_method_name),
186+
name=replace_methodname(route.name, url_path),
187187
initkwargs=initkwargs,
188188
))
189189
elif isinstance(route, DynamicListRoute):
190190
# Dynamic list routes (@list_route decorator)
191191
for httpmethods, methodname in list_routes:
192192
method_kwargs = getattr(viewset, methodname).kwargs
193-
custom_method_name = method_kwargs.pop("custom_method_name", None) or methodname
193+
url_path = method_kwargs.pop("url_path", None) or methodname
194194
initkwargs = route.initkwargs.copy()
195195
initkwargs.update(method_kwargs)
196196
ret.append(Route(
197-
url=replace_methodname(route.url, custom_method_name),
197+
url=replace_methodname(route.url, url_path),
198198
mapping=dict((httpmethod, methodname) for httpmethod in httpmethods),
199-
name=replace_methodname(route.name, custom_method_name),
199+
name=replace_methodname(route.name, url_path),
200200
initkwargs=initkwargs,
201201
))
202202
else:

0 commit comments

Comments
 (0)