perf: ip -> address

pull/8931/head
feng626 2 years ago
parent ffdb3f3b83
commit 33948d614b

@ -16,5 +16,5 @@ class GatheredUserViewSet(OrgModelViewSet):
serializer_class = GatheredUserSerializer
extra_filter_backends = [AssetRelatedByNodeFilterBackend]
filterset_fields = ['asset', 'username', 'present', 'asset__ip', 'asset__name', 'asset_id']
search_fields = ['username', 'asset__ip', 'asset__name']
filterset_fields = ['asset', 'username', 'present', 'asset__address', 'asset__name', 'asset_id']
search_fields = ['username', 'asset__address', 'asset__name']

@ -98,7 +98,7 @@ class Asset(AbsConnectivity, NodesRelationMixin, JMSOrgBaseModel):
objects = AssetManager.from_queryset(AssetQuerySet)()
def __str__(self):
return '{0.name}({0.ip})'.format(self)
return '{0.name}({0.address})'.format(self)
def get_target_ip(self):
return self.address

@ -144,7 +144,7 @@ class CommandExecutionHostRelationViewSet(OrgRelationMixin, OrgBulkModelViewSet)
queryset = queryset.annotate(
asset_display=Concat(
F('asset__name'), Value('('),
F('asset__ip'), Value(')')
F('asset__address'), Value(')')
)
)
return queryset

@ -49,7 +49,7 @@ class CommandExecutionFilter(BaseFilterSet):
queryset = queryset.annotate(
hostname_ip=Concat(
F('asset__hostname'), Value('('),
F('asset__ip'), Value(')')
F('asset__address'), Value(')')
)
).filter(hostname_ip__icontains=value)
return queryset

@ -78,7 +78,7 @@ class AssetPermissionAssetRelationViewSet(RelationMixin):
filterset_fields = [
'id', 'asset', 'assetpermission',
]
search_fields = ["id", "asset__name", "asset__ip", "assetpermission__name"]
search_fields = ["id", "asset__name", "asset__address", "assetpermission__name"]
def get_queryset(self):
queryset = super().get_queryset()

Loading…
Cancel
Save