Django backend for WorkX project
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.
Ce dépôt est archivé. Vous pouvez voir les fichiers et le cloner, mais vous ne pouvez pas pousser ni ouvrir de ticket/demande d'ajout.

17 lignes
615 B

  1. from rest_framework.response import Response
  2. from rest_framework.views import APIView
  3. from rest_framework.authentication import TokenAuthentication, SessionAuthentication
  4. from rest_framework.permissions import IsAuthenticated
  5. from .models import Project
  6. from .serializers import ProjectSerializer
  7. class ProjectList(APIView):
  8. authentication_classes = [TokenAuthentication, SessionAuthentication]
  9. permission_classes = [IsAuthenticated]
  10. def get(self, request):
  11. projects = Project.objects.all()
  12. serializer = ProjectSerializer(projects, many=True)
  13. return Response(serializer.data)