aboutsummaryrefslogtreecommitdiffstats
path: root/rest_framework/routers.py
diff options
context:
space:
mode:
authorMarlon Bailey2013-05-11 22:26:34 -0400
committerMarlon Bailey2013-05-11 22:26:34 -0400
commit9d2580dccfe23e113221c7e150bddebb95d98214 (patch)
tree4d07b3aa372d8cfabb919b35ff41e003f30a26e2 /rest_framework/routers.py
parentfd4a66cfc7888775d20b18665d63156cf3dae13a (diff)
downloaddjango-rest-framework-9d2580dccfe23e113221c7e150bddebb95d98214.tar.bz2
added support for multiple @action and @link decorators on a viewset, along with a router testcase illustrating the failure against the master code base
Diffstat (limited to 'rest_framework/routers.py')
-rw-r--r--rest_framework/routers.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/rest_framework/routers.py b/rest_framework/routers.py
index 0707635a..ebdf2b2a 100644
--- a/rest_framework/routers.py
+++ b/rest_framework/routers.py
@@ -127,18 +127,18 @@ class SimpleRouter(BaseRouter):
"""
# Determine any `@action` or `@link` decorated methods on the viewset
- dynamic_routes = {}
+ dynamic_routes = []
for methodname in dir(viewset):
attr = getattr(viewset, methodname)
httpmethod = getattr(attr, 'bind_to_method', None)
if httpmethod:
- dynamic_routes[httpmethod] = methodname
+ dynamic_routes.append((httpmethod, methodname))
ret = []
for route in self.routes:
if route.mapping == {'{httpmethod}': '{methodname}'}:
# Dynamic routes (@link or @action decorator)
- for httpmethod, methodname in dynamic_routes.items():
+ for httpmethod, methodname in dynamic_routes:
initkwargs = route.initkwargs.copy()
initkwargs.update(getattr(viewset, methodname).kwargs)
ret.append(Route(