Improve query speed for supplierpart api

This commit is contained in:
Oliver Walters 2019-05-21 08:19:16 +10:00
parent 9d5b938ced
commit f19d4eec79

View File

@ -75,7 +75,14 @@ class SupplierPartList(generics.ListCreateAPIView):
- POST: Create a new SupplierPart object
"""
queryset = SupplierPart.objects.all()
queryset = SupplierPart.objects.all().prefetch_related(
'part',
'part__category',
'part__stock_items',
'part__bom_items',
'part__builds',
'supplier')
serializer_class = SupplierPartSerializer
permission_classes = [