mirror of
https://github.com/jumpserver/jumpserver.git
synced 2025-09-17 07:49:01 +00:00
perf: tickets notifications add default data migrate file (#13268)
Co-authored-by: feng <1304903146@qq.com>
This commit is contained in:
22
apps/notifications/migrations/0003_initial_admin_msg.py
Normal file
22
apps/notifications/migrations/0003_initial_admin_msg.py
Normal file
@@ -0,0 +1,22 @@
|
||||
# Generated by Django 4.1.13 on 2024-05-21 11:04
|
||||
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
def init_user_msg_subscription(apps, schema_editor):
|
||||
User = apps.get_model('users', 'User')
|
||||
UserMsgSubscription = apps.get_model('notifications', 'UserMsgSubscription')
|
||||
|
||||
receive_backends = ['site_msg', 'email']
|
||||
user = User.objects.get(username='admin')
|
||||
UserMsgSubscription.objects.create(user=user, receive_backends=receive_backends)
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
dependencies = [
|
||||
('notifications', '0002_auto_20210909_1946'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RunPython(init_user_msg_subscription),
|
||||
]
|
Reference in New Issue
Block a user