mirror of
https://github.com/jumpserver/jumpserver.git
synced 2025-08-31 15:11:27 +00:00
fix: 修改翻译
This commit is contained in:
committed by
Jiangjie.Bai
parent
7e638ff8de
commit
42c3c85863
@@ -5,11 +5,40 @@ from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
|
||||
|
||||
def init_user_msg_subscription(apps, schema_editor):
|
||||
UserMsgSubscription = apps.get_model('notifications', 'UserMsgSubscription')
|
||||
User = apps.get_model('users', 'User')
|
||||
|
||||
to_create = []
|
||||
users = User.objects.all()
|
||||
for user in users:
|
||||
receive_backends = []
|
||||
|
||||
receive_backends.append('site_msg')
|
||||
|
||||
if user.email:
|
||||
receive_backends.append('email')
|
||||
|
||||
if user.wecom_id:
|
||||
receive_backends.append('wecom')
|
||||
|
||||
if user.dingtalk_id:
|
||||
receive_backends.append('dingtalk')
|
||||
|
||||
if user.feishu_id:
|
||||
receive_backends.append('feishu')
|
||||
|
||||
to_create.append(UserMsgSubscription(user=user, receive_backends=receive_backends))
|
||||
UserMsgSubscription.objects.bulk_create(to_create)
|
||||
print(f'\n Init user message subscription: {len(to_create)}')
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
||||
('notifications', '0001_initial'),
|
||||
('users', '0036_user_feishu_id'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
@@ -22,4 +51,5 @@ class Migration(migrations.Migration):
|
||||
name='user',
|
||||
field=models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='user_msg_subscription', to=settings.AUTH_USER_MODEL),
|
||||
),
|
||||
migrations.RunPython(init_user_msg_subscription)
|
||||
]
|
||||
|
@@ -1,43 +0,0 @@
|
||||
# Generated by Django 3.1.12 on 2021-08-23 07:52
|
||||
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
def init_user_msg_subscription(apps, schema_editor):
|
||||
UserMsgSubscription = apps.get_model('notifications', 'UserMsgSubscription')
|
||||
User = apps.get_model('users', 'User')
|
||||
|
||||
to_create = []
|
||||
users = User.objects.all()
|
||||
for user in users:
|
||||
receive_backends = []
|
||||
|
||||
receive_backends.append('site_msg')
|
||||
|
||||
if user.email:
|
||||
receive_backends.append('email')
|
||||
|
||||
if user.wecom_id:
|
||||
receive_backends.append('wecom')
|
||||
|
||||
if user.dingtalk_id:
|
||||
receive_backends.append('dingtalk')
|
||||
|
||||
if user.feishu_id:
|
||||
receive_backends.append('feishu')
|
||||
|
||||
to_create.append(UserMsgSubscription(user=user, receive_backends=receive_backends))
|
||||
UserMsgSubscription.objects.bulk_create(to_create)
|
||||
print(f'\n Init user message subscription: {len(to_create)}')
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('users', '0036_user_feishu_id'),
|
||||
('notifications', '0002_auto_20210909_1946'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RunPython(init_user_msg_subscription)
|
||||
]
|
Reference in New Issue
Block a user