from rest_framework.response import Response from rest_framework.views import APIView from rest_framework.authentication import TokenAuthentication, SessionAuthentication from rest_framework.permissions import IsAuthenticated from .models import Project from .serializers import ProjectSerializer class ProjectList(APIView): authentication_classes = [TokenAuthentication, SessionAuthentication] permission_classes = [IsAuthenticated] def get(self, request): projects = Project.objects.all() serializer = ProjectSerializer(projects, many=True) return Response(serializer.data)