From 3c93ed6a75c4fe3bc8c992d435c0999d1435f28f Mon Sep 17 00:00:00 2001 From: Bai Date: Tue, 17 Jan 2023 11:48:49 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E6=94=B9=E8=BF=81=E7=A7=BB=20c?= =?UTF-8?q?onnection-token=20system=5Fuser=20->=20account=20=E5=AD=97?= =?UTF-8?q?=E6=AE=B5=E5=A4=B1=E8=B4=A5=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/authentication/migrations/0012_auto_20220816_1629.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/apps/authentication/migrations/0012_auto_20220816_1629.py b/apps/authentication/migrations/0012_auto_20220816_1629.py index 07c9559ce..8f8bb9ffa 100644 --- a/apps/authentication/migrations/0012_auto_20220816_1629.py +++ b/apps/authentication/migrations/0012_auto_20220816_1629.py @@ -16,9 +16,11 @@ def migrate_system_user_to_account(apps, schema_editor): count += len(connection_tokens) updated = [] for connection_token in connection_tokens: + if not connection_token.system_user: + continue connection_token.account = connection_token.system_user.username updated.append(connection_token) - connection_token_model.objects.bulk_update(updated, ['account_username']) + connection_token_model.objects.bulk_update(updated, ['account']) class Migration(migrations.Migration):