From 965ec7007c506116e4a5e954d367ed824d3991a1 Mon Sep 17 00:00:00 2001 From: wangruidong <940853815@qq.com> Date: Mon, 25 Aug 2025 15:00:31 +0800 Subject: [PATCH] perf: Enhance eager loading by including labels in queryset --- apps/perms/serializers/user_permission.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/perms/serializers/user_permission.py b/apps/perms/serializers/user_permission.py index 639fb6320..c7390b2ec 100644 --- a/apps/perms/serializers/user_permission.py +++ b/apps/perms/serializers/user_permission.py @@ -41,7 +41,7 @@ class AssetPermedSerializer(OrgResourceModelSerializerMixin, ResourceLabelsMixin @classmethod def setup_eager_loading(cls, queryset): """ Perform necessary eager loading of data. """ - queryset = queryset.prefetch_related('zone', 'nodes') \ + queryset = queryset.prefetch_related('zone', 'nodes', "labels", "labels__label") \ .prefetch_related('platform') \ .annotate(category=F("platform__category")) \ .annotate(type=F("platform__type"))