fix: 平台导入无协议port (#10702)

Co-authored-by: feng <1304903146@qq.com>
pull/10705/head
fit2bot 2023-06-13 17:57:48 +08:00 committed by GitHub
parent 370d944396
commit 5bd4a882cc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 0 deletions

View File

@ -86,6 +86,13 @@ class PlatformProtocolSerializer(serializers.ModelSerializer):
"secret_types", "setting",
]
def to_file_representation(self, data):
return '{name}/{port}'.format(**data)
def to_file_internal_value(self, data):
name, port = data.split('/')
return {'name': name, 'port': port}
class PlatformCustomField(serializers.Serializer):
TYPE_CHOICES = [(t, t) for t, c in type_field_map.items()]