From 57b858a98a56a1586469d40624b5eefa1f12e620 Mon Sep 17 00:00:00 2001 From: Matti Eiden Date: Wed, 2 Oct 2024 21:44:25 +0300 Subject: [PATCH] perf: prefetch translations in LabelViewSet refs: KER-250 --- democracy/views/label.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/democracy/views/label.py b/democracy/views/label.py index 11d468a3..828b26a9 100644 --- a/democracy/views/label.py +++ b/democracy/views/label.py @@ -23,7 +23,7 @@ class Meta: class LabelViewSet(AuditLogApiView, viewsets.ReadOnlyModelViewSet, mixins.CreateModelMixin): serializer_class = LabelSerializer - queryset = Label.objects.all() + queryset = Label.objects.all().prefetch_related("translations") pagination_class = DefaultLimitPagination permission_classes = (permissions.IsAuthenticatedOrReadOnly,) filter_backends = (django_filters.rest_framework.DjangoFilterBackend,)