fix: notification migrate file (#13269)

Co-authored-by: feng <1304903146@qq.com>
pull/13273/head
fit2bot 2024-05-22 10:47:55 +08:00 committed by GitHub
parent 82977f9023
commit f259509ef8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 3 additions and 1 deletions

View File

@ -9,7 +9,9 @@ def init_user_msg_subscription(apps, schema_editor):
receive_backends = ['site_msg', 'email']
user = User.objects.get(username='admin')
UserMsgSubscription.objects.create(user=user, receive_backends=receive_backends)
UserMsgSubscription.objects.update_or_create(
defaults={'receive_backends': receive_backends}, user=user
)
class Migration(migrations.Migration):