feat: gather user添加搜索字段

pull/4107/head
ibuler 2020-06-16 15:30:25 +08:00
parent 80d94074e7
commit 19e34270d1
2 changed files with 3 additions and 9 deletions

View File

@ -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']

View File

@ -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