jumpserver/apps/assets/serializers/asset/host.py

22 lines
640 B
Python
Raw Normal View History

2022-09-01 06:46:31 +00:00
from django.utils.translation import gettext_lazy as _
from assets.models import Host
from .common import AssetSerializer
from .info.gathered import HostGatheredInfoSerializer
2022-09-01 06:46:31 +00:00
__all__ = ['HostSerializer']
2022-09-01 06:46:31 +00:00
class HostSerializer(AssetSerializer):
gathered_info = HostGatheredInfoSerializer(required=False, read_only=True, label=_("Gathered info"))
2022-09-01 06:46:31 +00:00
class Meta(AssetSerializer.Meta):
model = Host
fields = AssetSerializer.Meta.fields + ['gathered_info']
2022-10-19 10:56:46 +00:00
extra_kwargs = {
**AssetSerializer.Meta.extra_kwargs,
'address': {
'label': _("IP/Host")
},
}