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