36 lines
1.3 KiB
Python
36 lines
1.3 KiB
Python
# Generated by Django 3.2.25 on 2026-10-10 07:48
|
|
|
|
from django.db import migrations, models
|
|
|
|
|
|
def scrub_brand(apps, schema_editor):
|
|
"""حذف نام برند از متن قالبهایی که پیشتر با «کتیبه» ذخیره شدهاند."""
|
|
SMSTemplate = apps.get_model("admin_panel", "SMSTemplate")
|
|
for template in SMSTemplate.objects.filter(text__contains="کتیبه"):
|
|
cleaned = (
|
|
template.text.replace("به خانواده کتیبه خوش آمدید. ", "")
|
|
.replace(" نزد کتیبه", "")
|
|
)
|
|
template.text = cleaned
|
|
template.save(update_fields=["text"])
|
|
|
|
|
|
def noop(apps, schema_editor):
|
|
pass
|
|
|
|
|
|
class Migration(migrations.Migration):
|
|
|
|
dependencies = [
|
|
('admin_panel', '0064_sms_webservice_delivery'),
|
|
]
|
|
|
|
operations = [
|
|
migrations.AddField(
|
|
model_name='smsproviderconfig',
|
|
name='test_message',
|
|
field=models.TextField(blank=True, default='پیامک آزمایشی؛ جهت بررسی صحت ارسال از پنل فرستاده شده است.', help_text='متنی که با دکمهٔ «ارسال پیامک آزمایشی» فرستاده میشود؛ قابل ویرایش است.', verbose_name='متن پیامک آزمایشی'),
|
|
),
|
|
migrations.RunPython(scrub_brand, noop),
|
|
]
|