Django backend for WorkX project
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.
Это архивный репозиторий. Вы можете его клонировать или просматривать файлы, но не вносить изменения или открывать задачи/запросы на слияние.

3 лет назад
3 лет назад
1234567891011121314151617181920212223242526
  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 Item, Invoice
  5. from .serializers import ItemSerializer, InvoiceSerializer, DetailedInvoiceSerializer
  6. class ItemViewSet(viewsets.ModelViewSet):
  7. queryset = Item.objects.all()
  8. serializer_class = ItemSerializer
  9. authentication_classes = [TokenAuthentication, SessionAuthentication]
  10. permission_classes = [IsAuthenticated]
  11. class InvoiceViewSet(viewsets.ModelViewSet):
  12. queryset = Invoice.objects.all()
  13. serializer_class = InvoiceSerializer
  14. authentication_classes = [TokenAuthentication, SessionAuthentication]
  15. permission_classes = [IsAuthenticated]
  16. class DetailedInvoiceViewSet(viewsets.ReadOnlyModelViewSet):
  17. queryset = Invoice.objects.all()
  18. serializer_class = DetailedInvoiceSerializer
  19. authentication_classes = [TokenAuthentication, SessionAuthentication]
  20. permission_classes = [IsAuthenticated]