Additional filtering options for name and IPN fields

This commit is contained in:
Oliver 2021-07-08 17:46:57 +10:00
parent f0e7826fdc
commit 79d90b1c4a

View File

@ -349,10 +349,12 @@ class StockFilter(rest_filters.FilterSet):
# Part name filters
name = rest_filters.CharFilter(label='Part name (case insensitive)', field_name='part__name', lookup_expr='iexact')
name_contains = rest_filters.CharFilter(label='Part name contains (case insensitive)', field_name='part__name', lookup_expr='icontains')
name_regex = rest_filters.CharFilter(label='Part name (regex)', field_name='part__name', lookup_expr='iregex')
# Part IPN filters
ipn = rest_filters.CharFilter(label='Part IPN (case insensitive)', field_name='part__IPN', lookup_expr='iexact')
ipn_contains = rest_filters.CharFilter(label='Part IPN contains (case insensitive)', field_name='part__IPN', lookup_expr='icontains')
ipn_regex = rest_filters.CharFilter(label='Part IPN (regex)', field_name='part__IPN', lookup_expr='iregex')
# Part attribute filters
@ -864,9 +866,6 @@ class StockList(generics.ListCreateAPIView):
filters.OrderingFilter,
]
filter_fields = [
]
ordering_fields = [
'part__name',
'part__IPN',