|
@@ -10,8 +10,8 @@ class ItemList(APIView): |
|
|
authentication_classes = [TokenAuthentication, SessionAuthentication] |
|
|
authentication_classes = [TokenAuthentication, SessionAuthentication] |
|
|
permission_classes = [IsAuthenticated] |
|
|
permission_classes = [IsAuthenticated] |
|
|
|
|
|
|
|
|
def get(self, request): |
|
|
|
|
|
items = Item.objects.filter(pk=Item.invoice) |
|
|
|
|
|
|
|
|
def get(self, request, invoice_key): |
|
|
|
|
|
items = Item.objects.filter(invoice=invoice_key) |
|
|
serializer = ItemSerializer(items, many=True) |
|
|
serializer = ItemSerializer(items, many=True) |
|
|
return Response(serializer.data) |
|
|
return Response(serializer.data) |
|
|
|
|
|
|
|
@@ -21,6 +21,7 @@ class InvoiceList(APIView): |
|
|
permission_classes = [IsAuthenticated] |
|
|
permission_classes = [IsAuthenticated] |
|
|
|
|
|
|
|
|
def get(self, request): |
|
|
def get(self, request): |
|
|
items = Invoice.objects.all() |
|
|
|
|
|
serializer = InvoiceSerializer(items, many=True) |
|
|
|
|
|
return Response(serializer.data) |
|
|
|
|
|
|
|
|
invoices = Invoice.objects.all() |
|
|
|
|
|
invoice_serializer = InvoiceSerializer(invoices, many=True) |
|
|
|
|
|
|
|
|
|
|
|
return Response(invoice_serializer.data) |