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:
@ -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()
|
||||||
|
@ -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()
|
||||||
|
@ -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()
|
||||||
|
Reference in New Issue
Block a user