From 79d90b1c4a375848b78d1a7667ebca4b3e318581 Mon Sep 17 00:00:00 2001 From: Oliver Date: Thu, 8 Jul 2021 17:46:57 +1000 Subject: [PATCH] Additional filtering options for name and IPN fields --- InvenTree/stock/api.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/InvenTree/stock/api.py b/InvenTree/stock/api.py index fc18ee7731..9fb3e356a5 100644 --- a/InvenTree/stock/api.py +++ b/InvenTree/stock/api.py @@ -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',