Django backend for WorkX project
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.

12345678910111213141516171819
  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
  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]