From cee1062b515e0b7ab3f45427d2f72a4232391b55 Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Mon, 20 May 2019 08:16:28 +1000 Subject: [PATCH] Prefetch locations - 2.6s However the 'total_stock' and 'available_stock' fields are still the majority of the response time --- InvenTree/part/serializers.py | 1 + 1 file changed, 1 insertion(+) diff --git a/InvenTree/part/serializers.py b/InvenTree/part/serializers.py index 0e0c708156..a303ea7aa1 100644 --- a/InvenTree/part/serializers.py +++ b/InvenTree/part/serializers.py @@ -61,6 +61,7 @@ class PartSerializer(serializers.ModelSerializer): @staticmethod def setup_eager_loading(queryset): queryset = queryset.prefetch_related('category') + queryset = queryset.prefetch_related('locations') return queryset class Meta: