You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
53 lines
3.6 KiB
53 lines
3.6 KiB
# Generated by Django 4.2.30 on 2026-07-11 13:28
|
|
|
|
from django.db import migrations, models
|
|
import django.db.models.deletion
|
|
|
|
|
|
class Migration(migrations.Migration):
|
|
|
|
dependencies = [
|
|
('django_celery_beat', '0018_improve_crontab_helptext'),
|
|
('account', '0006_notification_action_notification_navigate_to_and_more'),
|
|
]
|
|
|
|
operations = [
|
|
migrations.CreateModel(
|
|
name='NotificationTemplate',
|
|
fields=[
|
|
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
|
('notification_type', models.CharField(max_length=50, unique=True, verbose_name='notification type')),
|
|
('name', models.CharField(max_length=100, verbose_name='name')),
|
|
('is_active', models.BooleanField(default=True, verbose_name='is active')),
|
|
('title_fa', models.CharField(max_length=255, verbose_name='title (FA)')),
|
|
('title_en', models.CharField(max_length=255, verbose_name='title (EN)')),
|
|
('body_fa', models.TextField(max_length=1024, verbose_name='body (FA)')),
|
|
('body_en', models.TextField(max_length=1024, verbose_name='body (EN)')),
|
|
('placeholders_info', models.CharField(blank=True, max_length=255, null=True, verbose_name='allowed placeholders description')),
|
|
],
|
|
options={
|
|
'verbose_name': 'Notification Template',
|
|
'verbose_name_plural': 'Notification Templates',
|
|
},
|
|
),
|
|
migrations.CreateModel(
|
|
name='ScheduledNotification',
|
|
fields=[
|
|
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
|
('name', models.CharField(max_length=100, verbose_name='campaign name')),
|
|
('target_group', models.CharField(choices=[('all_students', 'All Students'), ('inactive_students', 'Students Inactive for > 7 Days'), ('all_professors', 'All Professors')], max_length=50, verbose_name='target group')),
|
|
('is_active', models.BooleanField(default=True, verbose_name='is active')),
|
|
('schedule_type', models.CharField(choices=[('daily', 'Daily'), ('weekly', 'Weekly'), ('monthly', 'Monthly'), ('cron', 'Custom Cron Expression')], default='daily', max_length=20, verbose_name='schedule type')),
|
|
('time_of_day', models.TimeField(default='09:00:00', verbose_name='time of day')),
|
|
('days_of_week', models.CharField(blank=True, help_text='Comma-separated days (1 for Mon, 6 for Sat, 0 for Sun). E.g. "6,0" for Sat and Sun.', max_length=50, null=True, verbose_name='days of week')),
|
|
('days_of_month', models.CharField(blank=True, help_text='Comma-separated days of month (1-31). E.g. "1" for first day of the month.', max_length=50, null=True, verbose_name='days of month')),
|
|
('custom_cron', models.CharField(blank=True, help_text='Standard 5-field cron expression: minute hour day_of_month month day_of_week', max_length=100, null=True, verbose_name='custom cron expression')),
|
|
('periodic_task', models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='scheduled_notification', to='django_celery_beat.periodictask')),
|
|
('template', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='account.notificationtemplate', verbose_name='template')),
|
|
],
|
|
options={
|
|
'verbose_name': 'Scheduled Notification',
|
|
'verbose_name_plural': 'Scheduled Notifications',
|
|
},
|
|
),
|
|
]
|