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
|
2023-04-10 02:57:44 +00:00
|
|
|
from .info.gathered import HostGatheredInfoSerializer
|
2022-09-01 06:46:31 +00:00
|
|
|
|
2023-04-10 02:57:44 +00:00
|
|
|
__all__ = ['HostSerializer']
|
2022-09-01 06:46:31 +00:00
|
|
|
|
|
|
|
|
|
|
|
class HostSerializer(AssetSerializer):
|
2023-04-10 02:57:44 +00:00
|
|
|
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
|
2023-04-10 02:57:44 +00:00
|
|
|
fields = AssetSerializer.Meta.fields + ['gathered_info']
|
2022-10-19 10:56:46 +00:00
|
|
|
extra_kwargs = {
|
|
|
|
**AssetSerializer.Meta.extra_kwargs,
|
|
|
|
'address': {
|
|
|
|
'label': _("IP/Host")
|
|
|
|
},
|
|
|
|
}
|