From 0ba84e7e18820d5258b90cbb3e20943c19839027 Mon Sep 17 00:00:00 2001 From: Bai Date: Thu, 23 Mar 2023 11:52:18 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=8E=BB=E6=8E=89=E7=B3=BB=E7=BB=9F?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E5=BA=8F=E5=88=97=E7=B1=BB=E4=B8=AD=E7=9A=84?= =?UTF-8?q?=E8=B5=84=E4=BA=A7=E6=95=B0=E9=87=8F=E5=92=8C=E5=BA=94=E7=94=A8?= =?UTF-8?q?=E6=95=B0=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/assets/serializers/system_user.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/apps/assets/serializers/system_user.py b/apps/assets/serializers/system_user.py index 7b4321d73..f4d1318e8 100644 --- a/apps/assets/serializers/system_user.py +++ b/apps/assets/serializers/system_user.py @@ -36,9 +36,6 @@ class SystemUserSerializer(AuthSerializerMixin, BulkOrgResourceModelSerializer): token = EncryptedField( label=_('Token'), required=False, write_only=True, style={'base_template': 'textarea.html'} ) - applications_amount = serializers.IntegerField( - source='apps_amount', read_only=True, label=_('Apps amount') - ) class Meta: model = SystemUser @@ -53,7 +50,7 @@ class SystemUserSerializer(AuthSerializerMixin, BulkOrgResourceModelSerializer): 'su_enabled', 'su_from', 'date_created', 'date_updated', 'comment', 'created_by', ] - fields_m2m = ['cmd_filters', 'assets_amount', 'applications_amount', 'nodes'] + fields_m2m = ['cmd_filters', 'nodes'] fields = fields_small + fields_m2m extra_kwargs = { 'cmd_filters': {"required": False, 'label': _('Command filter')}, @@ -241,7 +238,6 @@ class SystemUserSerializer(AuthSerializerMixin, BulkOrgResourceModelSerializer): def setup_eager_loading(cls, queryset): """ Perform necessary eager loading of data. """ queryset = queryset \ - .annotate(assets_amount=Count("assets")) \ .prefetch_related('nodes', 'cmd_filters') return queryset