summaryrefslogtreecommitdiff
path: root/procurement/api.py
blob: d1830c251c99ba305c360fa47e616c3e0eaac4a5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
from rest_framework.generics import ListAPIView, RetrieveAPIView

from procurement.models import Component, Supplier
from procurement.serializers import ComponentSerializer, SupplierSerializer, SupplierComponentsSerializer


class ComponentAPIList(ListAPIView):
    queryset = Component.objects.all()
    serializer_class = ComponentSerializer


class ComponentAPIRetrieve(RetrieveAPIView):
    queryset = Component.objects.all()
    serializer_class = ComponentSerializer

class SupplierAPIList(ListAPIView):
    queryset = Supplier.objects.filter(is_authorized=True)
    serializer_class = SupplierSerializer

class SupplierAPIRetrieve(RetrieveAPIView):
    queryset = Supplier.objects.filter(is_authorized=True)
    serializer_class = SupplierSerializer

class SupplierAPIComponents(RetrieveAPIView):
    queryset = Supplier.objects.filter(is_authorized=True)
    serializer_class = SupplierComponentsSerializer