From 62193e037859498bd8c87139ed63ebfd2cf8c324 Mon Sep 17 00:00:00 2001 From: Jonathan Longe Date: Wed, 15 Jan 2020 11:58:31 -0800 Subject: [PATCH] Add permissions to quickstart tutorial (#7113) --- docs/tutorial/quickstart.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/tutorial/quickstart.md b/docs/tutorial/quickstart.md index ee54816dc..505f7f91d 100644 --- a/docs/tutorial/quickstart.md +++ b/docs/tutorial/quickstart.md @@ -85,6 +85,7 @@ Right, we'd better write some views then. Open `tutorial/quickstart/views.py` a from django.contrib.auth.models import User, Group from rest_framework import viewsets + from rest_framework import permissions from tutorial.quickstart.serializers import UserSerializer, GroupSerializer @@ -94,6 +95,7 @@ Right, we'd better write some views then. Open `tutorial/quickstart/views.py` a """ queryset = User.objects.all().order_by('-date_joined') serializer_class = UserSerializer + permission_classes = [permissions.IsAuthenticated] class GroupViewSet(viewsets.ModelViewSet): @@ -102,6 +104,7 @@ Right, we'd better write some views then. Open `tutorial/quickstart/views.py` a """ queryset = Group.objects.all() serializer_class = GroupSerializer + permission_classes = [permissions.IsAuthenticated] Rather than write multiple views we're grouping together all the common behavior into classes called `ViewSets`.