aboutsummaryrefslogtreecommitdiffstats
path: root/docs/api-guide/routers.md
diff options
context:
space:
mode:
authorJosé Padilla2014-10-31 09:04:39 -0400
committerDougal Matthews2014-11-25 12:44:11 +0000
commit16d442dda3ee9d4ff40d067d76706959aac4c6a3 (patch)
tree2f180dd2ba39e9bed2dea0bbadc85815a043b471 /docs/api-guide/routers.md
parentcbb6799d2dc2d87e58e67e1044075319262a674b (diff)
downloaddjango-rest-framework-16d442dda3ee9d4ff40d067d76706959aac4c6a3.tar.bz2
Use MkDocs meta.source to render source code links
Diffstat (limited to 'docs/api-guide/routers.md')
-rw-r--r--docs/api-guide/routers.md8
1 files changed, 4 insertions, 4 deletions
diff --git a/docs/api-guide/routers.md b/docs/api-guide/routers.md
index 61a476b8..080230fa 100644
--- a/docs/api-guide/routers.md
+++ b/docs/api-guide/routers.md
@@ -1,4 +1,4 @@
-<a class="github" href="routers.py"></a>
+source: routers.py
# Routers
@@ -56,10 +56,10 @@ For example, given a method like this on the `UserViewSet` class:
from myapp.permissions import IsAdminOrIsSelf
from rest_framework.decorators import detail_route
-
+
class UserViewSet(ModelViewSet):
...
-
+
@detail_route(methods=['post'], permission_classes=[IsAdminOrIsSelf])
def set_password(self, request, pk=None):
...
@@ -228,7 +228,7 @@ For another example of setting the `.routes` attribute, see the source code for
## Advanced custom routers
-If you want to provide totally custom behavior, you can override `BaseRouter` and override the `get_urls(self)` method. The method should inspect the registered viewsets and return a list of URL patterns. The registered prefix, viewset and basename tuples may be inspected by accessing the `self.registry` attribute.
+If you want to provide totally custom behavior, you can override `BaseRouter` and override the `get_urls(self)` method. The method should inspect the registered viewsets and return a list of URL patterns. The registered prefix, viewset and basename tuples may be inspected by accessing the `self.registry` attribute.
You may also want to override the `get_default_base_name(self, viewset)` method, or else always explicitly set the `base_name` argument when registering your viewsets with the router.