# Generated by Django 5.2.19 on 2026-11-22 05:02 import django.core.validators import django.db.models.deletion import uuid from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('catalog', '0013_studio_reader_and_traffic'), ] operations = [ migrations.CreateModel( name='NewsletterCampaign', fields=[ ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('subject', models.CharField(max_length=160)), ('preheader', models.CharField(blank=True, max_length=160)), ('body', models.TextField(help_text='Use blank lines between paragraphs. The newsletter layout and unsubscribe link are added automatically.', max_length=20000)), ('link_label', models.CharField(blank=True, max_length=55)), ('link_url', models.URLField(blank=True, max_length=500, validators=[django.core.validators.URLValidator(schemes=['https'])])), ('queued_at', models.DateTimeField(blank=True, editable=False, null=True)), ('created_at', models.DateTimeField(auto_now_add=True)), ], options={ 'ordering': ['-created_at'], 'permissions': [('send_newsletter', 'Can send newsletters and test emails')], }, ), migrations.CreateModel( name='NewsletterGate', fields=[ ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('window', models.DateTimeField()), ('requests', models.PositiveIntegerField(default=0)), ], ), migrations.CreateModel( name='NewsletterSubscriber', fields=[ ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('email', models.EmailField(max_length=254, unique=True)), ('status', models.CharField(choices=[('pending', 'Awaiting confirmation'), ('active', 'Subscribed'), ('out', 'Unsubscribed')], db_index=True, default='pending', max_length=12)), ('requested_at', models.DateTimeField(blank=True, null=True)), ('opted_in_at', models.DateTimeField(blank=True, null=True)), ('opted_out_at', models.DateTimeField(blank=True, null=True)), ('confirm_token', models.UUIDField(default=uuid.uuid4, editable=False, unique=True)), ('unsubscribe_token', models.UUIDField(default=uuid.uuid4, editable=False, unique=True)), ('confirm_queued', models.BooleanField(db_index=True, default=False)), ], ), migrations.CreateModel( name='NewsletterDelivery', fields=[ ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('status', models.CharField(choices=[('queued', 'Waiting'), ('sending', 'Sending'), ('sent', 'Accepted by SMTP'), ('failed', 'Delivery error'), ('skipped', 'No longer subscribed'), ('uncertain', 'Outcome unknown')], db_index=True, default='queued', max_length=12)), ('attempted_at', models.DateTimeField(null=True)), ('error', models.CharField(blank=True, max_length=100)), ('campaign', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='deliveries', to='catalog.newslettercampaign')), ('subscriber', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='catalog.newslettersubscriber')), ], options={ 'constraints': [models.UniqueConstraint(fields=('campaign', 'subscriber'), name='slx_unique_newsletter_delivery')], }, ), ]