From e29e51121dcc071207f7c895ddf6cda24d988849 Mon Sep 17 00:00:00 2001 From: fit2bot <68588906+fit2bot@users.noreply.github.com> Date: Tue, 16 Jan 2024 11:33:21 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E4=BC=98=E5=8C=96=E8=B4=A6=E5=8F=B7?= =?UTF-8?q?=E7=89=88=E6=9C=AC=E8=AE=A1=E7=AE=97=E7=AD=96=E7=95=A5=20(#1254?= =?UTF-8?q?7)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: feng <1304903146@qq.com> --- apps/accounts/signal_handlers.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/accounts/signal_handlers.py b/apps/accounts/signal_handlers.py index d086a049c..4c87df5cf 100644 --- a/apps/accounts/signal_handlers.py +++ b/apps/accounts/signal_handlers.py @@ -21,7 +21,8 @@ def on_account_pre_save(sender, instance, **kwargs): if instance.version == 0: instance.version = 1 else: - instance.version = instance.history.count() + history_account = instance.history.first() + instance.version = history_account.version + 1 if history_account else 0 @merge_delay_run(ttl=5)