Skip to content

Commit f3529f1

Browse files
committed
Correct docs' incorrect usage of action decorator
If you don't call it, it doesn't work.
1 parent 6d2ca75 commit f3529f1

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

docs/api-guide/viewsets.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ Let's define a simple viewset that can be used to list or retrieve all the users
2727
queryset = User.objects.all()
2828
serializer = UserSerializer(queryset, many=True)
2929
return Response(serializer.data)
30-
30+
3131
def retrieve(self, request, pk=None):
3232
queryset = User.objects.all()
3333
user = get_object_or_404(queryset, pk=pk)
@@ -69,7 +69,7 @@ The default routers included with REST framework will provide routes for a stand
6969
"""
7070
Example empty viewset demonstrating the standard
7171
actions that will be handled by a router class.
72-
72+
7373
If you're using format suffixes, make sure to also include
7474
the `format=None` keyword argument for each action.
7575
"""
@@ -103,12 +103,12 @@ For example:
103103

104104
class UserViewSet(viewsets.ModelViewSet):
105105
"""
106-
A viewset that provides the standard actions
106+
A viewset that provides the standard actions
107107
"""
108108
queryset = User.objects.all()
109109
serializer_class = UserSerializer
110-
111-
@action
110+
111+
@action()
112112
def set_password(self, request, pk=None):
113113
user = self.get_object()
114114
serializer = PasswordSerializer(data=request.DATA)
@@ -197,7 +197,7 @@ As with `ModelViewSet`, you'll normally need to provide at least the `queryset`
197197

198198
Again, as with `ModelViewSet`, you can use any of the standard attributes and method overrides available to `GenericAPIView`.
199199

200-
# Custom ViewSet base classes
200+
# Custom ViewSet base classes
201201

202202
You may need to provide custom `ViewSet` classes that do not have the full set of `ModelViewSet` actions, or that customize the behavior in some other way.
203203

@@ -211,7 +211,7 @@ To create a base viewset class that provides `create`, `list` and `retrieve` ope
211211
viewsets.GenericViewSet):
212212
"""
213213
A viewset that provides `retrieve`, `update`, and `list` actions.
214-
214+
215215
To use it, override the class and set the `.queryset` and
216216
`.serializer_class` attributes.
217217
"""

0 commit comments

Comments
 (0)