perf: 优化导入导出

pull/10003/head
ibuler 2023-03-17 18:44:21 +08:00
parent cad6fffd74
commit 12db64ea18
5 changed files with 6 additions and 6 deletions

View File

@ -81,7 +81,7 @@ class AccountAssetSerializer(serializers.ModelSerializer):
def to_internal_value(self, data):
if isinstance(data, dict):
i = data.get('id')
i = data.get('id') or data.get('pk')
else:
i = data

View File

@ -16,7 +16,7 @@ class AuthValidateMixin(serializers.Serializer):
choices=SecretType.choices, required=True, label=_('Secret type')
)
secret = EncryptedField(
label=_('Secret/Password'), required=False, max_length=40960, allow_blank=True,
label=_('Secret'), required=False, max_length=40960, allow_blank=True,
allow_null=True, write_only=True,
)
passphrase = serializers.CharField(

View File

@ -111,7 +111,7 @@ class BaseFileParser(BaseParser):
return {'pk': obj_id, 'name': obj_name}
def parse_value(self, field, value):
if value is '-':
if value is '-' and field and field.allow_null:
return None
elif hasattr(field, 'to_file_internal_value'):
value = field.to_file_internal_value(value)

View File

@ -584,7 +584,7 @@ msgid "Asset type"
msgstr "資産タイプ"
#: accounts/serializers/account/base.py:19
msgid "Secret/Password"
msgid "Secret"
msgstr "キー/パスワード"
#: accounts/serializers/account/base.py:24

View File

@ -580,8 +580,8 @@ msgid "Asset type"
msgstr "资产类型"
#: accounts/serializers/account/base.py:19
msgid "Secret/Password"
msgstr "密钥/密码"
msgid "Secret"
msgstr "密"
#: accounts/serializers/account/base.py:24
msgid "Key password"