aboutsummaryrefslogtreecommitdiffstats
path: root/rest_framework/routers.py
diff options
context:
space:
mode:
authorAlex Burgel2013-05-24 18:28:47 -0400
committerAlex Burgel2013-05-24 18:28:47 -0400
commit112b52f57e8f5a4a54e2b0c40f442ee63daf9709 (patch)
treea16037fd97cb8bd46710ebb6097046a94e717f64 /rest_framework/routers.py
parent02b29267acd3e3afabe6497a6ed04b10888d8731 (diff)
downloaddjango-rest-framework-112b52f57e8f5a4a54e2b0c40f442ee63daf9709.tar.bz2
Allow action decorator to handle multiple http methods
Diffstat (limited to 'rest_framework/routers.py')
-rw-r--r--rest_framework/routers.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/rest_framework/routers.py b/rest_framework/routers.py
index dba104c3..6c5fd004 100644
--- a/rest_framework/routers.py
+++ b/rest_framework/routers.py
@@ -131,20 +131,20 @@ class SimpleRouter(BaseRouter):
dynamic_routes = []
for methodname in dir(viewset):
attr = getattr(viewset, methodname)
- httpmethod = getattr(attr, 'bind_to_method', None)
- if httpmethod:
- dynamic_routes.append((httpmethod, methodname))
+ httpmethods = getattr(attr, 'bind_to_methods', None)
+ if httpmethods:
+ dynamic_routes.append((httpmethods, methodname))
ret = []
for route in self.routes:
if route.mapping == {'{httpmethod}': '{methodname}'}:
# Dynamic routes (@link or @action decorator)
- for httpmethod, methodname in dynamic_routes:
+ for httpmethods, methodname in dynamic_routes:
initkwargs = route.initkwargs.copy()
initkwargs.update(getattr(viewset, methodname).kwargs)
ret.append(Route(
url=replace_methodname(route.url, methodname),
- mapping={httpmethod: methodname},
+ mapping=dict((httpmethod, methodname) for httpmethod in httpmethods),
name=replace_methodname(route.name, methodname),
initkwargs=initkwargs,
))