Browse Source

通过 api 添加资产,不写 protocols 时,默认值应该是列表

pull/6059/head
jing guo 4 years ago committed by 老广
parent
commit
9fe5496ce9
  1. 2
      apps/assets/serializers/asset.py

2
apps/assets/serializers/asset.py

@ -65,7 +65,7 @@ class AssetSerializer(BulkOrgResourceModelSerializer):
platform = serializers.SlugRelatedField(
slug_field='name', queryset=Platform.objects.all(), label=_("Platform")
)
protocols = ProtocolsField(label=_('Protocols'), required=False)
protocols = ProtocolsField(label=_('Protocols'), required=False, default=['ssh/22'])
domain_display = serializers.ReadOnlyField(source='domain.name', label=_('Domain name'))
admin_user_display = serializers.ReadOnlyField(source='admin_user.name', label=_('Admin user name'))
nodes_display = serializers.ListField(child=serializers.CharField(), label=_('Nodes name'), required=False)

Loading…
Cancel
Save