sms
This commit is contained in:
1 parent
250cdbab7f
commit
5c6069c3ef
87 files changed
+29209
-3697
No files matched your search
@@ -0,0 +1,42 @@
|
||||
# Generated by Django 3.2.25 on 2026-10-10 08:05
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
def backfill_keys(apps, schema_editor):
|
||||
"""کلیدهای صفِ موجود را به دفتر منتقل میکند تا حذف بعدیشان باعث بازگشت نشود."""
|
||||
SMSQueue = apps.get_model("admin_panel", "SMSQueue")
|
||||
SMSDedup = apps.get_model("admin_panel", "SMSDedup")
|
||||
keys = SMSQueue.objects.exclude(dedup_key__isnull=True).exclude(
|
||||
dedup_key=""
|
||||
).values_list("dedup_key", flat=True)
|
||||
SMSDedup.objects.bulk_create(
|
||||
[SMSDedup(key=key) for key in keys], ignore_conflicts=True,
|
||||
)
|
||||
|
||||
|
||||
def noop(apps, schema_editor):
|
||||
pass
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('admin_panel', '0065_smsproviderconfig_test_message'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='SMSDedup',
|
||||
fields=[
|
||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('key', models.CharField(max_length=120, unique=True)),
|
||||
('created_at', models.DateTimeField(auto_now_add=True)),
|
||||
],
|
||||
options={
|
||||
'verbose_name': 'کلید پردازش\u200cشدهٔ پیامک',
|
||||
'verbose_name_plural': 'کلیدهای پردازش\u200cشدهٔ پیامک',
|
||||
},
|
||||
),
|
||||
migrations.RunPython(backfill_keys, noop),
|
||||
]
|
||||
Reference in new issue
Block a user