Prefetch locations - 2.6s

However the 'total_stock' and 'available_stock' fields are still the majority of the response time
This commit is contained in:
Oliver Walters 2019-05-20 08:16:28 +10:00
parent 6766063c8b
commit cee1062b51

View File

@ -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: