2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-06-16 20:15:44 +00:00

Simplify API query filtering

This commit is contained in:
Oliver Walters
2024-12-28 16:52:47 +11:00
parent 2ce17f6d44
commit 06c858ae7c
3 changed files with 3 additions and 3 deletions

View File

@ -41,7 +41,7 @@ class BuildFilter(rest_filters.FilterSet):
Note: Also account for the possibility of a custom status code Note: Also account for the possibility of a custom status code
""" """
q1 = Q(status=value, status_custom_key__isnull=True) q1 = Q(status=value)
q2 = Q(status_custom_key=value) q2 = Q(status_custom_key=value)
return queryset.filter(q1 | q2).distinct() return queryset.filter(q1 | q2).distinct()

View File

@ -86,7 +86,7 @@ class OrderFilter(rest_filters.FilterSet):
Note: Also account for the possibility of a custom status code. Note: Also account for the possibility of a custom status code.
""" """
q1 = Q(status=value, status_custom_key__isnull=True) q1 = Q(status=value)
q2 = Q(status_custom_key=value) q2 = Q(status_custom_key=value)
return queryset.filter(q1 | q2).distinct() return queryset.filter(q1 | q2).distinct()

View File

@ -575,7 +575,7 @@ class StockFilter(rest_filters.FilterSet):
Note: Also account for the possibility of a custom status code. Note: Also account for the possibility of a custom status code.
""" """
q1 = Q(status=value, status_custom_key__isnull=True) q1 = Q(status=value)
q2 = Q(status_custom_key=value) q2 = Q(status_custom_key=value)
return queryset.filter(q1 | q2).distinct() return queryset.filter(q1 | q2).distinct()