aboutsummaryrefslogtreecommitdiffstats
path: root/docs/tutorial/6-viewsets-and-routers.md
diff options
context:
space:
mode:
authorTom Christie2013-08-21 20:36:07 +0100
committerTom Christie2013-08-21 20:36:07 +0100
commitdb25aaff3a05b5a2d7022fb925362a1bbfb19113 (patch)
treece609152347a424ea451c535035eb4960c705c1b /docs/tutorial/6-viewsets-and-routers.md
parent28e44efe25b5373f0f46357e4e26f7cb0482efa6 (diff)
parent8acee2e626746f3096c49b3ebb13aaf7dc882917 (diff)
downloaddjango-rest-framework-db25aaff3a05b5a2d7022fb925362a1bbfb19113.tar.bz2
Merge branch 'static-routes' into 0.4.0
Diffstat (limited to 'docs/tutorial/6-viewsets-and-routers.md')
-rw-r--r--docs/tutorial/6-viewsets-and-routers.md8
1 files changed, 4 insertions, 4 deletions
diff --git a/docs/tutorial/6-viewsets-and-routers.md b/docs/tutorial/6-viewsets-and-routers.md
index 8a1a1ae0..29c53162 100644
--- a/docs/tutorial/6-viewsets-and-routers.md
+++ b/docs/tutorial/6-viewsets-and-routers.md
@@ -25,7 +25,7 @@ Here we've used `ReadOnlyModelViewSet` class to automatically provide the defaul
Next we're going to replace the `SnippetList`, `SnippetDetail` and `SnippetHighlight` view classes. We can remove the three views, and again replace them with a single class.
- from rest_framework.decorators import link
+ from rest_framework.decorators import detail_route
class SnippetViewSet(viewsets.ModelViewSet):
"""
@@ -39,7 +39,7 @@ Next we're going to replace the `SnippetList`, `SnippetDetail` and `SnippetHighl
permission_classes = (permissions.IsAuthenticatedOrReadOnly,
IsOwnerOrReadOnly,)
- @link(renderer_classes=[renderers.StaticHTMLRenderer])
+ @detail_route(renderer_classes=[renderers.StaticHTMLRenderer])
def highlight(self, request, *args, **kwargs):
snippet = self.get_object()
return Response(snippet.highlighted)
@@ -49,9 +49,9 @@ Next we're going to replace the `SnippetList`, `SnippetDetail` and `SnippetHighl
This time we've used the `ModelViewSet` class in order to get the complete set of default read and write operations.
-Notice that we've also used the `@link` decorator to create a custom action, named `highlight`. This decorator can be used to add any custom endpoints that don't fit into the standard `create`/`update`/`delete` style.
+Notice that we've also used the `@detail_route` decorator to create a custom action, named `highlight`. This decorator can be used to add any custom endpoints that don't fit into the standard `create`/`update`/`delete` style.
-Custom actions which use the `@link` decorator will respond to `GET` requests. We could have instead used the `@action` decorator if we wanted an action that responded to `POST` requests.
+Custom actions which use the `@detail_route` decorator will respond to `GET` requests. We can use the `methods` argument if we wanted an action that responded to `POST` requests.
## Binding ViewSets to URLs explicitly