# Generated by Django 2.2.1 on 2019-09-09 21:07

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


class Migration(migrations.Migration):

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
        ('courses', '0012_auto_20190904_1555'),
    ]

    operations = [
        migrations.CreateModel(
            name='EnrolledModules',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('deleted', models.DateTimeField(editable=False, null=True)),
                ('date_activated', models.DateTimeField(auto_now_add=True, verbose_name='date activated')),
                ('days', models.IntegerField(default=7, verbose_name='open for')),
                ('expires', models.DateTimeField(verbose_name='date expires')),
                ('enrolled', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='modules', to='courses.Enrolled')),
            ],
        ),
        migrations.AlterField(
            model_name='modules',
            name='students',
            field=models.ManyToManyField(related_name='modules', through='courses.EnrolledModules', to=settings.AUTH_USER_MODEL),
        ),
        migrations.DeleteModel(
            name='UserModules',
        ),
        migrations.AddField(
            model_name='enrolledmodules',
            name='module',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='courses.Modules'),
        ),
        migrations.AddField(
            model_name='enrolledmodules',
            name='user',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL),
        ),
        migrations.AlterUniqueTogether(
            name='enrolledmodules',
            unique_together={('user', 'module')},
        ),
    ]
