From 0de6c4140678edfa2f73bb23b912903dd8fed544 Mon Sep 17 00:00:00 2001 From: fit2bot <68588906+fit2bot@users.noreply.github.com> Date: Thu, 20 Apr 2023 14:43:40 +0800 Subject: [PATCH] perf: update templat account (#10274) Co-authored-by: feng <1304903146@qq.com> --- apps/accounts/serializers/account/template.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/apps/accounts/serializers/account/template.py b/apps/accounts/serializers/account/template.py index e9804876b..f6ac16224 100644 --- a/apps/accounts/serializers/account/template.py +++ b/apps/accounts/serializers/account/template.py @@ -1,3 +1,4 @@ +from django.db.transaction import atomic from django.db.utils import IntegrityError from accounts.models import AccountTemplate, Account @@ -20,6 +21,7 @@ class AccountTemplateSerializer(BaseAccountSerializer): pass # TODO 数据库访问的太多了 后期优化 + @atomic() def bulk_update_accounts(self, instance, diff): accounts = Account.objects.filter(source_id=instance.id) if not accounts: