fix: Accounts of ssh key type will no longer export fingerprints. (#13215)

Co-authored-by: feng <1304903146@qq.com>
pull/13218/head
fit2bot 2024-05-14 13:04:11 +08:00 committed by GitHub
parent 0ea675f8d6
commit e8faaeb8fb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 11 additions and 0 deletions

View File

@ -43,6 +43,17 @@ class SecretReadableMixin(serializers.Serializer):
if 'write_only' not in field_extra_kwargs:
continue
serializer_field.write_only = field_extra_kwargs['write_only']
self.remove_spec_info_field()
def remove_spec_info_field(self):
request = self.context.get('request')
if not request:
return
_format = request.query_params.get('format')
if _format not in ['csv', 'xlsx']:
return
self.fields.pop('spec_info', None)
class BulkSerializerMixin(object):