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í.

21 řádky
796 B

  1. from rest_framework import viewsets
  2. from rest_framework.authentication import TokenAuthentication, SessionAuthentication
  3. from rest_framework.permissions import IsAuthenticated
  4. from .models import Representative, Role
  5. from .serializers import RoleSerializer, RepresentativeSerializer
  6. class RoleViewSet(viewsets.ReadOnlyModelViewSet):
  7. queryset = Role.objects.all()
  8. serializer_class = RoleSerializer
  9. authentication_classes = [TokenAuthentication, SessionAuthentication]
  10. permission_classes = [IsAuthenticated]
  11. class RepresentativeViewSet(viewsets.ReadOnlyModelViewSet):
  12. queryset = Representative.objects.all()
  13. serializer_class = RepresentativeSerializer
  14. authentication_classes = [TokenAuthentication, SessionAuthentication]
  15. permission_classes = [IsAuthenticated]