mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-08-05 13:00:12 +03:00
Parametrizable viewset custom views reverse name
This commit is contained in:
parent
06a5bcc88e
commit
b4e70dfdbf
|
@ -179,10 +179,11 @@ class SimpleRouter(BaseRouter):
|
||||||
initkwargs = route.initkwargs.copy()
|
initkwargs = route.initkwargs.copy()
|
||||||
initkwargs.update(method_kwargs)
|
initkwargs.update(method_kwargs)
|
||||||
url_path = initkwargs.pop("url_path", None) or methodname
|
url_path = initkwargs.pop("url_path", None) or methodname
|
||||||
|
url_name = initkwargs.pop("url_name", None) or url_path
|
||||||
ret.append(Route(
|
ret.append(Route(
|
||||||
url=replace_methodname(route.url, url_path),
|
url=replace_methodname(route.url, url_path),
|
||||||
mapping={httpmethod: methodname for httpmethod in httpmethods},
|
mapping={httpmethod: methodname for httpmethod in httpmethods},
|
||||||
name=replace_methodname(route.name, url_path),
|
name=replace_methodname(route.name, url_name),
|
||||||
initkwargs=initkwargs,
|
initkwargs=initkwargs,
|
||||||
))
|
))
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user