perf: 批量创建资产 账号格式错误提醒 (#11909)

Co-authored-by: feng <1304903146@qq.com>
pull/11915/head
fit2bot 2023-10-19 13:44:24 +08:00 committed by GitHub
parent 6870df6d75
commit 26a18a1f5c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 0 deletions

View File

@ -304,6 +304,10 @@ class AssetSerializer(BulkOrgResourceModelSerializer, WritableNestedModelSeriali
from accounts.models import AccountTemplate
if not accounts_data:
return
if not isinstance(accounts_data[0], dict):
raise serializers.ValidationError({'accounts': _("Invalid data")})
su_from_name_username_secret_type_map = {}
for data in accounts_data:
data['asset'] = asset.id