You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/api-guide/viewsets.md
+3-2Lines changed: 3 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -99,7 +99,8 @@ For example:
99
99
from django.contrib.auth.models import User
100
100
from rest_framework import viewsets
101
101
from rest_framework.decorators import action
102
-
from myapp.serializers import UserSerializer
102
+
from rest_framework.response import Response
103
+
from myapp.serializers import UserSerializer, PasswordSerializer
103
104
104
105
class UserViewSet(viewsets.ModelViewSet):
105
106
"""
@@ -176,7 +177,7 @@ Note that you can use any of the standard attributes or method overrides provide
176
177
permission_classes = [IsAccountAdminOrReadOnly]
177
178
178
179
def get_queryset(self):
179
-
return request.user.accounts.all()
180
+
return self.request.user.accounts.all()
180
181
181
182
Also note that although this class provides the complete set of create/list/retrieve/update/destroy actions by default, you can restrict the available operations by using the standard permission classes.
0 commit comments