Django backend for WorkX project
Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.
Tento repozitář je archivovaný. Můžete prohlížet soubory, klonovat, ale nemůžete nahrávat a vytvářet nové úkoly a požadavky na natažení.

12345678910111213141516
  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 Employee
  6. from .serializers import EmployeeSerializer
  7. class EmployeeList(APIView):
  8. authentication_classes = [TokenAuthentication, SessionAuthentication]
  9. permission_classes = [IsAuthenticated]
  10. def get(self, request):
  11. employees = Employee.objects.all()
  12. serializer = EmployeeSerializer(employees, many=True)
  13. return Response(serializer.data)