add: add filter
This commit is contained in:
@@ -45,6 +45,9 @@ class ExpenceListApiView(generics.GenericAPIView):
|
|||||||
permission_classes = [HasRolePermission]
|
permission_classes = [HasRolePermission]
|
||||||
|
|
||||||
def get(self, request):
|
def get(self, request):
|
||||||
|
cash_transaction_ids = request.query_params.getlist('cash_transaction')
|
||||||
|
if cash_transaction_ids:
|
||||||
|
self.queryset = self.queryset.filter(cash_transaction__in=cash_transaction_ids)
|
||||||
page = self.paginate_queryset(self.queryset)
|
page = self.paginate_queryset(self.queryset)
|
||||||
if page is not None:
|
if page is not None:
|
||||||
serializer = self.serializer_class(page, many=True)
|
serializer = self.serializer_class(page, many=True)
|
||||||
|
|||||||
@@ -16,6 +16,9 @@ class IncomeListApiView(generics.GenericAPIView):
|
|||||||
permission_classes = [HasRolePermission]
|
permission_classes = [HasRolePermission]
|
||||||
|
|
||||||
def get(self, request):
|
def get(self, request):
|
||||||
|
cash_transaction_ids = request.query_params.getlist('cash_transaction')
|
||||||
|
if cash_transaction_ids:
|
||||||
|
self.queryset = self.queryset.filter(cash_transaction__in=cash_transaction_ids)
|
||||||
page = self.paginate_queryset(self.queryset)
|
page = self.paginate_queryset(self.queryset)
|
||||||
if page is not None:
|
if page is not None:
|
||||||
serializer = self.serializer_class(page, many=True)
|
serializer = self.serializer_class(page, many=True)
|
||||||
@@ -47,3 +50,4 @@ class IncomeCreateApiView(generics.GenericAPIView):
|
|||||||
},
|
},
|
||||||
status=400
|
status=400
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user