<reponame>ericrobskyhuntley/vialab.mit.edu
# Generated by Django 3.0.4 on 2020-12-11 22:50

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


class Migration(migrations.Migration):

    dependencies = [
        ('cal', '0016_auto_20201211_1028'),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
        ('classes', '0003_auto_20201211_1104'),
    ]

    operations = [
        migrations.CreateModel(
            name='SessionTime',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('start', models.TimeField()),
                ('end', models.TimeField()),
                ('days', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='cal.Days')),
            ],
        ),
        migrations.RemoveField(
            model_name='class',
            name='days',
        ),
        migrations.RemoveField(
            model_name='class',
            name='lab1',
        ),
        migrations.RemoveField(
            model_name='class',
            name='lab2',
        ),
        migrations.RemoveField(
            model_name='class',
            name='lecture1',
        ),
        migrations.RemoveField(
            model_name='class',
            name='lecture2',
        ),
        migrations.RemoveField(
            model_name='class',
            name='lecture3',
        ),
        migrations.RemoveField(
            model_name='historicalclass',
            name='lab1',
        ),
        migrations.RemoveField(
            model_name='historicalclass',
            name='lab2',
        ),
        migrations.RemoveField(
            model_name='historicalclass',
            name='lecture1',
        ),
        migrations.RemoveField(
            model_name='historicalclass',
            name='lecture2',
        ),
        migrations.RemoveField(
            model_name='historicalclass',
            name='lecture3',
        ),
        migrations.CreateModel(
            name='SessionType',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('form', models.CharField(choices=[('L', 'Lecture'), ('B', 'Lab'), ('D', 'Discussion'), ('R', 'Recitation')], default='L', max_length=1)),
                ('cl', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='classes.Class')),
                ('session_time', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='classes.SessionTime')),
            ],
            options={
                'verbose_name': 'session',
                'verbose_name_plural': 'sessions',
            },
        ),
        migrations.CreateModel(
            name='HistoricalSessionType',
            fields=[
                ('id', models.IntegerField(auto_created=True, blank=True, db_index=True, verbose_name='ID')),
                ('form', models.CharField(choices=[('L', 'Lecture'), ('B', 'Lab'), ('D', 'Discussion'), ('R', 'Recitation')], default='L', max_length=1)),
                ('history_change_reason', models.TextField(null=True)),
                ('history_id', models.AutoField(primary_key=True, serialize=False)),
                ('history_date', models.DateTimeField()),
                ('history_type', models.CharField(choices=[('+', 'Created'), ('~', 'Changed'), ('-', 'Deleted')], max_length=1)),
                ('cl', models.ForeignKey(blank=True, db_constraint=False, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to='classes.Class')),
                ('history_user', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to=settings.AUTH_USER_MODEL)),
                ('session_time', models.ForeignKey(blank=True, db_constraint=False, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to='classes.SessionTime')),
            ],
            options={
                'verbose_name': 'historical session',
                'ordering': ('-history_date', '-history_id'),
                'get_latest_by': 'history_date',
            },
            bases=(simple_history.models.HistoricalChanges, models.Model),
        ),
        migrations.AddField(
            model_name='class',
            name='sessions',
            field=models.ManyToManyField(blank=True, through='classes.SessionType', to='classes.SessionTime'),
        ),
    ]
