mirror of
https://github.com/inventree/InvenTree.git
synced 2026-10-09 11:46:26 +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:
1 parent
10ecddf9b4
commit
245c9bfd28
3 files changed
+122
-7
No files matched your search
@@ -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