Adds ability to filter build items by "tracked" flag

This commit is contained in:
Oliver 2022-04-28 17:27:09 +10:00
parent e6c95bf6b2
commit 0841c628e0

View File

@ -442,6 +442,18 @@ class BuildItemList(generics.ListCreateAPIView):
if part_pk:
queryset = queryset.filter(stock_item__part=part_pk)
# Filter by "tracked" status
# Tracked means that the item is "installed" into a build output (stock item)
tracked = params.get('tracked', None)
if tracked is not None:
tracked = str2bool(tracked)
if tracked:
queryset = queryset.exclude(install_into=None)
else:
queryset = queryest.filter(install_into=None)
# Filter by output target
output = params.get('output', None)