summaryrefslogtreecommitdiff
path: root/app/lttr/migrations/0001_initial.py
blob: 557df91c1c36b1bdf4e2e7c3135f4c106fcbfff5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# Generated by Django 3.2.8 on 2022-02-04 20:50

from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import lttr.models


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('posts', '0002_alter_post_post_type'),
        ('media', '0001_initial'),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name='Newsletter',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('title', models.CharField(max_length=250)),
                ('slug', models.SlugField(unique=True)),
                ('intro', models.TextField(blank=True, null=True)),
            ],
        ),
        migrations.CreateModel(
            name='Subscriber',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('email_field', models.EmailField(blank=True, db_column='email', db_index=True, max_length=254, null=True)),
                ('date_created', models.DateTimeField(auto_now_add=True)),
                ('date_updated', models.DateTimeField(auto_now=True)),
                ('activation_code', models.CharField(default=lttr.models.make_activation_code, max_length=40)),
                ('subscribed', models.BooleanField(db_index=True, default=False)),
                ('subscribe_date', models.DateTimeField(blank=True, null=True)),
                ('unsubscribed', models.BooleanField(db_index=True, default=False)),
                ('unsubscribe_date', models.DateTimeField(blank=True, null=True)),
                ('newsletter', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='lttr.newsletter')),
                ('user', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.CreateModel(
            name='NewsletterMailing',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('title', models.CharField(blank=True, max_length=250)),
                ('subtitle', models.CharField(blank=True, max_length=250, null=True)),
                ('body_html', models.TextField(blank=True)),
                ('body_email_html', models.TextField(blank=True)),
                ('body_markdown', models.TextField(blank=True)),
                ('pub_date', models.DateTimeField(blank=True)),
                ('featured_image', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='media.luximage')),
                ('newsletter', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='lttr.newsletter')),
                ('post', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='posts.post')),
            ],
            options={
                'ordering': ('-title', '-pub_date'),
            },
        ),
        migrations.CreateModel(
            name='MailingStatus',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('status', models.IntegerField(choices=[(0, 'Initialized'), (1, 'Sent'), (2, 'Error')], null=True)),
                ('creation_date', models.DateTimeField(auto_now_add=True, verbose_name='creation date')),
                ('newsletter_mailing', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='lttr.newslettermailing', verbose_name='newsletter')),
                ('subscriber', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='lttr.subscriber', verbose_name='subscriber')),
            ],
            options={
                'verbose_name': 'subscriber mailing status',
                'verbose_name_plural': 'subscriber mailing statuses',
                'ordering': ('-creation_date',),
            },
        ),
    ]