diff options
| author | Yannick PEROUX | 2015-02-25 11:54:11 +0100 |
|---|---|---|
| committer | Yannick PEROUX | 2015-02-25 11:54:11 +0100 |
| commit | bdc64d4e7370575a70a167dc2ae5d159610ce184 (patch) | |
| tree | ee5d7b6e5439ed936e60f1162d17e6ef8986d055 /rest_framework/routers.py | |
| parent | b69032f3a794bbc45974a6b362b186c494373ae1 (diff) | |
| download | django-rest-framework-bdc64d4e7370575a70a167dc2ae5d159610ce184.tar.bz2 | |
Fix removal of url_path on @detail_route and @list_route. Fix # #2583
SimpleRouter.get_routes was popping out the url_path kwarg from
list_route and detail_route decorators. This was causing troubles
when the route was re-used, for example if the viewset was
inherited.
Diffstat (limited to 'rest_framework/routers.py')
| -rw-r--r-- | rest_framework/routers.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/rest_framework/routers.py b/rest_framework/routers.py index 6a4184e2..081654b8 100644 --- a/rest_framework/routers.py +++ b/rest_framework/routers.py @@ -171,9 +171,9 @@ class SimpleRouter(BaseRouter): # Dynamic detail routes (@detail_route decorator) for httpmethods, methodname in detail_routes: method_kwargs = getattr(viewset, methodname).kwargs - url_path = method_kwargs.pop("url_path", None) or methodname initkwargs = route.initkwargs.copy() initkwargs.update(method_kwargs) + url_path = initkwargs.pop("url_path", None) or methodname ret.append(Route( url=replace_methodname(route.url, url_path), mapping=dict((httpmethod, methodname) for httpmethod in httpmethods), @@ -184,9 +184,9 @@ class SimpleRouter(BaseRouter): # Dynamic list routes (@list_route decorator) for httpmethods, methodname in list_routes: method_kwargs = getattr(viewset, methodname).kwargs - url_path = method_kwargs.pop("url_path", None) or methodname initkwargs = route.initkwargs.copy() initkwargs.update(method_kwargs) + url_path = initkwargs.pop("url_path", None) or methodname ret.append(Route( url=replace_methodname(route.url, url_path), mapping=dict((httpmethod, methodname) for httpmethod in httpmethods), |
