2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-07-06 05:30:56 +00:00

Enhancement for the BuildItem API / serializer

- Add optional "part_detail" information
- Add optional "build_detail" information
- Add optional "location_detail" information
This commit is contained in:
Oliver
2021-06-18 19:08:54 +10:00
parent 10ecddf9b4
commit 245c9bfd28
3 changed files with 122 additions and 7 deletions

View File

@ -165,6 +165,16 @@ class BuildItemList(generics.ListCreateAPIView):
serializer_class = BuildItemSerializer
def get_serializer(self, *args, **kwargs):
params = self.request.query_params
kwargs['part_detail'] = str2bool(params.get('part_detail', False))
kwargs['build_detail'] = str2bool(params.get('build_detail', False))
kwargs['location_detail'] = str2bool(params.get('location_detail', False))
return self.serializer_class(*args, **kwargs)
def get_queryset(self):
""" Override the queryset method,
to allow filtering by stock_item.part