fixed bank account filtering, and id filtering

This commit is contained in:
DJ Gillespie 2023-11-03 15:53:37 -06:00
parent 6b377067e1
commit cd9a8c4d29

View File

@ -54,6 +54,14 @@ class SliceViewSet(viewsets.ModelViewSet):
queryset = Slice.objects.all() queryset = Slice.objects.all()
serializer_class = SliceSerializer serializer_class = SliceSerializer
filterset_fields = {
'id': ['exact', 'lte', 'gte'],
'name': ['exact',],
'balance': ['exact', 'lte', 'gte'],
'bank_acc': ['exact'],
# 'slice_of': ['exact']
}
class InstitutionViewSet(viewsets.ReadOnlyModelViewSet): class InstitutionViewSet(viewsets.ReadOnlyModelViewSet):
"""API endpoint that allows BankAccounts to be viewed. """API endpoint that allows BankAccounts to be viewed.
@ -71,12 +79,14 @@ class TransactionViewSet(viewsets.ModelViewSet):
'bank__official_name'] 'bank__official_name']
filterset_fields = { filterset_fields = {
'slice__id': ['exact', 'isnull'], 'slice__id': ['exact',],
'slice__name': ['exact', ], 'slice__name': ['exact', ],
'authorized_date': ['exact', 'lte', 'gte', 'isnull'], 'authorized_date': ['exact', 'lte', 'gte', 'isnull'],
'updated_at': ['exact', 'lte', 'gte', 'isnull'], 'updated_at': ['exact', 'lte', 'gte', 'isnull'],
'created_at': ['exact', 'lte', 'gte', 'isnull'], 'created_at': ['exact', 'lte', 'gte', 'isnull'],
'trans_id': ['exact', 'lte', 'gte', 'isnull'], 'trans_id': ['exact', 'lte', 'gte'],
'id': ['exact', 'lte', 'gte'],
'bank': ['exact']
} }
@action(detail=True, methods=['post'], url_path='split') @action(detail=True, methods=['post'], url_path='split')
@ -101,6 +111,14 @@ class SliceTransactionViewSet(viewsets.ModelViewSet):
serializer_class = SliceTransactionSerializer serializer_class = SliceTransactionSerializer
queryset = Slice.objects.all() queryset = Slice.objects.all()
filterset_fields = {
'id': ['exact', 'lte', 'gte'],
'name': ['exact',],
'balance': ['exact', 'lte', 'gte'],
'bank_acc': ['exact'],
# 'slice_of': ['exact']
}
# def get_queryset(self): # def get_queryset(self):
# return Transaction.objects.filter(slice__pk=self.kwargs.get('slice_pk')) # return Transaction.objects.filter(slice__pk=self.kwargs.get('slice_pk'))