From 19e34270d1261544e8e6b68fc2c3efa735b8aa74 Mon Sep 17 00:00:00 2001 From: ibuler Date: Tue, 16 Jun 2020 15:30:25 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20gather=20user=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E6=90=9C=E7=B4=A2=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/assets/api/gathered_user.py | 2 +- apps/assets/serializers/asset.py | 10 ++-------- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/apps/assets/api/gathered_user.py b/apps/assets/api/gathered_user.py index b9f137648..e024fedb1 100644 --- a/apps/assets/api/gathered_user.py +++ b/apps/assets/api/gathered_user.py @@ -18,5 +18,5 @@ class GatheredUserViewSet(OrgModelViewSet): permission_classes = [IsOrgAdmin] extra_filter_backends = [AssetRelatedByNodeFilterBackend] - filter_fields = ['asset', 'username', 'present'] + filter_fields = ['asset', 'username', 'present', 'asset__ip', 'asset__hostname'] search_fields = ['username', 'asset__ip', 'asset__hostname'] diff --git a/apps/assets/serializers/asset.py b/apps/assets/serializers/asset.py index e238c29a7..e36f41946 100644 --- a/apps/assets/serializers/asset.py +++ b/apps/assets/serializers/asset.py @@ -144,14 +144,8 @@ class AssetDisplaySerializer(AssetSerializer): connectivity = ConnectivitySerializer(read_only=True, label=_("Connectivity")) class Meta(AssetSerializer.Meta): - fields = [ - 'id', 'ip', 'hostname', 'protocol', 'port', - 'protocols', 'is_active', 'public_ip', - 'number', 'vendor', 'model', 'sn', - 'cpu_model', 'cpu_count', 'cpu_cores', 'cpu_vcpus', 'memory', - 'disk_total', 'disk_info', 'os', 'os_version', 'os_arch', - 'hostname_raw', 'comment', 'created_by', 'date_created', - 'hardware_info', 'connectivity', + fields = AssetSerializer.Meta.fields + [ + 'connectivity', ] @classmethod