jumpserver/apps/assets/serializers/gathered_user.py

26 lines
736 B
Python
Raw Normal View History

2019-09-18 14:06:46 +00:00
# -*- coding: utf-8 -*-
#
from django.utils.translation import ugettext_lazy as _
2019-09-18 14:06:46 +00:00
from orgs.mixins.serializers import OrgResourceModelSerializerMixin
from ..models import GatheredUser
2019-09-18 14:06:46 +00:00
class GatheredUserSerializer(OrgResourceModelSerializerMixin):
class Meta:
model = GatheredUser
2021-04-29 11:10:45 +00:00
fields_mini = ['id']
fields_small = fields_mini + [
'username', 'ip_last_login',
'present',
'date_last_login', 'date_created', 'date_updated'
2019-09-18 14:06:46 +00:00
]
2022-08-11 07:45:03 +00:00
fields_fk = ['asset', 'name', 'ip']
2021-04-29 11:10:45 +00:00
fields = fields_small + fields_fk
2019-09-18 14:06:46 +00:00
read_only_fields = fields
2020-05-20 09:45:50 +00:00
extra_kwargs = {
2022-08-11 07:45:03 +00:00
'name': {'label': _("Hostname")},
2020-05-20 09:45:50 +00:00
'ip': {'label': 'IP'},
}