diff options
| author | Tom Christie | 2013-08-19 20:36:18 +0100 | 
|---|---|---|
| committer | Tom Christie | 2013-08-19 20:36:18 +0100 | 
| commit | c607414f1637221486a6f13c6ce0d64dbe95957b (patch) | |
| tree | 39160b6c4bbd4af7b251907f0d5314c468230dc4 /docs/tutorial | |
| parent | 34d65119fc1c200b76a8af7213a92d6b279bd478 (diff) | |
| parent | eaae8fb2d973769a827214e0606a7e41028d5d34 (diff) | |
| download | django-rest-framework-c607414f1637221486a6f13c6ce0d64dbe95957b.tar.bz2 | |
Merge
Diffstat (limited to 'docs/tutorial')
| -rw-r--r-- | docs/tutorial/6-viewsets-and-routers.md | 8 | 
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 | 
