aboutsummaryrefslogtreecommitdiffstats
path: root/docs/api-guide/routers.md
diff options
context:
space:
mode:
authorOmer Katz2013-10-03 17:34:34 +0200
committerOmer Katz2013-10-03 17:34:34 +0200
commitab4be47379ba49092063f843fd446919534db776 (patch)
tree0c182f69956bd0bb37363bcfb27fe94cdcfe3f28 /docs/api-guide/routers.md
parent1bd8fe415296739521fd2e75c0b604cbf3dd3a83 (diff)
downloaddjango-rest-framework-ab4be47379ba49092063f843fd446919534db776.tar.bz2
Fixed code example.
Diffstat (limited to 'docs/api-guide/routers.md')
-rw-r--r--docs/api-guide/routers.md11
1 files changed, 7 insertions, 4 deletions
diff --git a/docs/api-guide/routers.md b/docs/api-guide/routers.md
index 730fa876..f20a695b 100644
--- a/docs/api-guide/routers.md
+++ b/docs/api-guide/routers.md
@@ -42,12 +42,15 @@ The example above would generate the following URL patterns:
Any methods on the viewset decorated with `@detail_route` or `@list_route` will also be routed.
For example, given a method like this on the `UserViewSet` class:
- from myapp.permissions import IsAdminOrIsSelf
+ from myapp.permissions import IsAdminOrIsSelf
from rest_framework.decorators import detail_route
-
- @detail_route(methods=['post'], permission_classes=[IsAdminOrIsSelf])
- def set_password(self, request, pk=None):
+
+ class UserViewSet(ModelViewSet):
...
+
+ @detail_route(methods=['post'], permission_classes=[IsAdminOrIsSelf])
+ def set_password(self, request, pk=None):
+ ...
The following URL pattern would additionally be generated: