From 77dd334026cb2f8a45b817c4577f5d5ea6a2671a Mon Sep 17 00:00:00 2001 From: Yuri Prezument Date: Sun, 14 Jul 2013 19:16:56 +0300 Subject: Fix Mixin class name in viewsets docs example --- docs/api-guide/viewsets.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'docs/api-guide/viewsets.md') diff --git a/docs/api-guide/viewsets.md b/docs/api-guide/viewsets.md index 25d11bfb..17c528b3 100644 --- a/docs/api-guide/viewsets.md +++ b/docs/api-guide/viewsets.md @@ -205,9 +205,9 @@ You may need to provide custom `ViewSet` classes that do not have the full set o To create a base viewset class that provides `create`, `list` and `retrieve` operations, inherit from `GenericViewSet`, and mixin the required actions: - class CreateListRetrieveViewSet(mixins.CreateMixin, - mixins.ListMixin, - mixins.RetrieveMixin, + class CreateListRetrieveViewSet(mixins.CreateModelMixin, + mixins.ListModelMixin, + mixins.RetrieveModelMixin, viewsets.GenericViewSet): """ A viewset that provides `retrieve`, `update`, and `list` actions. -- cgit v1.2.3 From 3eaad89c160c478e3706206535929ad0658ae8c5 Mon Sep 17 00:00:00 2001 From: Tom Christie Date: Mon, 15 Jul 2013 21:23:34 +0100 Subject: Docs fix --- docs/api-guide/viewsets.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'docs/api-guide/viewsets.md') diff --git a/docs/api-guide/viewsets.md b/docs/api-guide/viewsets.md index 17c528b3..47e59e2b 100644 --- a/docs/api-guide/viewsets.md +++ b/docs/api-guide/viewsets.md @@ -99,7 +99,8 @@ For example: from django.contrib.auth.models import User from rest_framework import viewsets from rest_framework.decorators import action - from myapp.serializers import UserSerializer + from rest_framework.response import Response + from myapp.serializers import UserSerializer, PasswordSerializer class UserViewSet(viewsets.ModelViewSet): """ @@ -176,7 +177,7 @@ Note that you can use any of the standard attributes or method overrides provide permission_classes = [IsAccountAdminOrReadOnly] def get_queryset(self): - return request.user.accounts.all() + return self.request.user.accounts.all() 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. -- cgit v1.2.3 From b676cce61f364095caa0bdbc46c22cdc87b98646 Mon Sep 17 00:00:00 2001 From: Eric Buehl Date: Thu, 18 Jul 2013 19:03:38 -0700 Subject: pedantic doc updates --- docs/api-guide/viewsets.md | 1 + 1 file changed, 1 insertion(+) (limited to 'docs/api-guide/viewsets.md') diff --git a/docs/api-guide/viewsets.md b/docs/api-guide/viewsets.md index 47e59e2b..0c68afb0 100644 --- a/docs/api-guide/viewsets.md +++ b/docs/api-guide/viewsets.md @@ -98,6 +98,7 @@ For example: from django.contrib.auth.models import User from rest_framework import viewsets + from rest_framework import status from rest_framework.decorators import action from rest_framework.response import Response from myapp.serializers import UserSerializer, PasswordSerializer -- cgit v1.2.3