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