# Generated by Django 3.2.5 on 2021-07-14 10:50

from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

    initial = True

    dependencies = [
    ]

    operations = [
        migrations.CreateModel(
            name='HtmlTemplate',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('template_location', models.CharField(max_length=30)),
                ('template_name', models.CharField(max_length=30, unique=True)),
            ],
        ),
        migrations.CreateModel(
            name='Mailing',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('mailing_name', models.CharField(max_length=30, unique=True)),
                ('mailing_date', models.DateField()),
                ('mailing_status', models.BooleanField(default=False, null=True)),
                ('mailing_subject', models.CharField(blank=True, max_length=30)),
            ],
            options={
                'ordering': ['mailing_name'],
            },
        ),
        migrations.CreateModel(
            name='Receiver',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('email', models.EmailField(max_length=50, unique=True)),
                ('name', models.CharField(blank=True, max_length=20)),
                ('lastname', models.CharField(blank=True, max_length=20)),
                ('bday', models.DateField(blank=True)),
            ],
            options={
                'ordering': ['email'],
            },
        ),
        migrations.CreateModel(
            name='MailingReceiver',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('send', models.BooleanField(default=True)),
                ('send_date', models.DateTimeField(auto_now=True)),
                ('received', models.BooleanField(default=False)),
                ('received_date', models.DateTimeField(blank=True, null=True)),
                ('mailing', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='emailapp.mailing')),
                ('receiver', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='emailapp.receiver')),
            ],
        ),
        migrations.CreateModel(
            name='MailingList',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('mailinglist_name', models.CharField(max_length=30, unique=True)),
                ('receivers', models.ManyToManyField(to='emailapp.Receiver')),
            ],
            options={
                'ordering': ['mailinglist_name'],
            },
        ),
        migrations.AddField(
            model_name='mailing',
            name='mailing_list',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='emailapp.mailinglist'),
        ),
        migrations.AddField(
            model_name='mailing',
            name='mailing_template',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='emailapp.htmltemplate'),
        ),
    ]
