1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
| from django.shortcuts import render from django.contrib.auth.models import User # Create your views here. from rest_framework.views import APIView from rest_framework.response import Response from rest_framework.permissions import IsAuthenticated from .serializers import UserSerializer
class UserAPIView(APIView): # permission_classes = [IsAuthenticated]
def get(self, request): users = User.objects.all() serializer = UserSerializer(users, many=True) return Response(serializer.data)
|