From 8b9d5ad766eddac9480a42864e4f1ea3ae3f0b73 Mon Sep 17 00:00:00 2001 From: Tanner Collin Date: Sat, 17 Jun 2023 19:48:06 +0000 Subject: [PATCH] Select related members for storage to speed up query --- apiserver/apiserver/api/views.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apiserver/apiserver/api/views.py b/apiserver/apiserver/api/views.py index 10f6ce8..f6b80c3 100644 --- a/apiserver/apiserver/api/views.py +++ b/apiserver/apiserver/api/views.py @@ -1791,7 +1791,7 @@ class HostingViewSet(Base): class StorageSpaceViewSet(Base, List, Retrieve, Update): permission_classes = [AllowMetadata | IsAuthenticated, IsAdminOrReadOnly] - queryset = models.StorageSpace.objects.all().order_by('id') + queryset = models.StorageSpace.objects.all().select_related('user__member').order_by('id') serializer_class = serializers.StorageSpaceSerializer @action(detail=False, methods=['post'], permission_classes=[AllowMetadata | IsAuthenticated])