fix(assets): 修复网关信息没有密码的bug

pull/6169/head
ibuler 2021-05-21 15:13:43 +08:00 committed by Jiangjie.Bai
parent 9ccde03656
commit d765e61991
1 changed files with 7 additions and 7 deletions

View File

@ -59,7 +59,7 @@ class GatewaySerializer(AuthSerializerMixin, BulkOrgResourceModelSerializer):
'created_by', 'comment', 'created_by', 'comment',
] ]
fields_fk = ['domain'] fields_fk = ['domain']
fields = fields_small + fields_fk fields = fields_small + fields_fk
extra_kwargs = { extra_kwargs = {
'password': {'write_only': True, 'validators': [NoSpecialChars()]}, 'password': {'write_only': True, 'validators': [NoSpecialChars()]},
'private_key': {"write_only": True}, 'private_key': {"write_only": True},
@ -78,12 +78,12 @@ class GatewaySerializer(AuthSerializerMixin, BulkOrgResourceModelSerializer):
class GatewayWithAuthSerializer(GatewaySerializer): class GatewayWithAuthSerializer(GatewaySerializer):
def get_field_names(self, declared_fields, info): class Meta(GatewaySerializer.Meta):
fields = super().get_field_names(declared_fields, info) extra_kwargs = {
fields.extend( 'password': {'write_only': False, 'validators': [NoSpecialChars()]},
['password', 'private_key'] 'private_key': {"write_only": False},
) 'public_key': {"write_only": False},
return fields }
class DomainWithGatewaySerializer(BulkOrgResourceModelSerializer): class DomainWithGatewaySerializer(BulkOrgResourceModelSerializer):