# Generated by Django 2.2.19 on 2021-03-06 04:39

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


class Migration(migrations.Migration):

    initial = True

    dependencies = [
    ]

    operations = [
        migrations.CreateModel(
            name='Course',
            fields=[
                ('course_code', models.CharField(max_length=8, primary_key=True, serialize=False, validators=[django.core.validators.RegexValidator(message='Course code needs to have 4 capital letters followed by 4 numbers', regex='^[A-Z]{4}\\d{4}$')])),
                ('course_name', models.CharField(max_length=30)),
            ],
        ),
        migrations.CreateModel(
            name='Enrolment',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('term_taken', models.CharField(max_length=20)),
                ('letter_grade', models.CharField(blank=True, max_length=2, null=True, validators=[django.core.validators.RegexValidator(message='Grade needs to be one of FL, PS, CR, DN, HD', regex='^(FL|PS|CR|DN|HD)$')])),
                ('mark', models.IntegerField(blank=True, null=True, validators=[django.core.validators.MinValueValidator(0), django.core.validators.MaxValueValidator(100)])),
                ('course', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='courses.Course')),
            ],
        ),
        migrations.CreateModel(
            name='Student',
            fields=[
                ('z_id', models.CharField(max_length=8, primary_key=True, serialize=False, validators=[django.core.validators.RegexValidator(message='zId needs to start with z followed by 7 numbers', regex='^z\\d{7}$')])),
                ('first_name', models.CharField(max_length=30)),
                ('last_name', models.CharField(max_length=30)),
                ('courses', models.ManyToManyField(through='courses.Enrolment', to='courses.Course')),
            ],
        ),
        migrations.AddField(
            model_name='enrolment',
            name='student',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='courses.Student'),
        ),
    ]
