2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-08-06 20:11:37 +00:00

Updates for stock serializer

This commit is contained in:
Oliver Walters
2020-04-20 00:49:13 +10:00
parent 5233281a24
commit 6a89e0089d
4 changed files with 45 additions and 89 deletions

View File

@@ -205,6 +205,13 @@ class PartList(generics.ListCreateAPIView):
headers = self.get_success_headers(serializer.data)
return Response(serializer.data, status=status.HTTP_201_CREATED, headers=headers)
def get_queryset(self, *args, **kwargs):
queryset = super().get_queryset(*args, **kwargs)
queryset = part_serializers.PartSerializer.prefetch_queryset(queryset)
return queryset
def filter_queryset(self, queryset):
"""
Perform custom filtering of the queryset

View File

@@ -113,10 +113,7 @@ class PartSerializer(InvenTreeModelSerializer):
'builds',
'supplier_parts',
'supplier_parts__purchase_order_line_items',
'supplier_parts__purcahes_order_line_items__order',
'starred_users',
'starred_user__user',
'starred_user__part',
'supplier_parts__purchase_order_line_items__order',
)
@staticmethod