mirror of
https://github.com/inventree/InvenTree.git
synced 2025-04-29 03:56:43 +00:00
Ability to filter build list by status
This commit is contained in:
parent
f0ffb0f8c0
commit
5d70f496a5
@ -41,6 +41,22 @@ class BuildList(generics.ListCreateAPIView):
|
|||||||
'part',
|
'part',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
def get_queryset(self):
|
||||||
|
"""
|
||||||
|
Override the queryset filtering,
|
||||||
|
as some of the fields don't natively play nicely with DRF
|
||||||
|
"""
|
||||||
|
|
||||||
|
build_list = super().get_queryset()
|
||||||
|
|
||||||
|
# Filter by build status?
|
||||||
|
status = self.request.query_params.get('status', None)
|
||||||
|
|
||||||
|
if status is not None:
|
||||||
|
build_list = build_list.filter(status=status)
|
||||||
|
|
||||||
|
return build_list
|
||||||
|
|
||||||
def get_serializer(self, *args, **kwargs):
|
def get_serializer(self, *args, **kwargs):
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user