# Generated by Django 3.0.11 on 2021-04-20 03:30

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


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('account', '0001_initial'),
    ]

    operations = [
        migrations.CreateModel(
            name='Class',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('registration_date', models.DateTimeField(auto_created=True, auto_now=True)),
                ('class_name', models.CharField(max_length=20, unique=True)),
            ],
            options={
                'verbose_name_plural': 'Classes',
            },
        ),
        migrations.CreateModel(
            name='Exam',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('exam_year', models.DateField()),
                ('exam_date_time', models.DateTimeField(auto_now_add=True)),
                ('exam_term', models.CharField(choices=[('First Term', 'First Term'), ('Second Term', 'Second Term'), ('Third Term', 'Third Term')], max_length=100)),
                ('is_publish', models.BooleanField(default=False)),
                ('exam_class', models.ManyToManyField(to='result.Class')),
            ],
        ),
        migrations.CreateModel(
            name='ParentType',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('type', models.CharField(max_length=255, unique=True)),
                ('date_created', models.DateTimeField(auto_now_add=True)),
            ],
        ),
        migrations.CreateModel(
            name='Subject',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('registration_date', models.DateTimeField(auto_created=True)),
                ('subject_code', models.CharField(max_length=100, unique=True)),
            ],
        ),
        migrations.CreateModel(
            name='SubjectClass',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('classes', models.ForeignKey(on_delete=django.db.models.deletion.DO_NOTHING, to='result.Class')),
                ('subject_code', models.ForeignKey(on_delete=django.db.models.deletion.DO_NOTHING, to='result.Subject')),
            ],
            options={
                'verbose_name_plural': 'Subject and Class',
                'unique_together': {('subject_code', 'classes')},
            },
        ),
        migrations.CreateModel(
            name='Parent',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('full_name', models.CharField(max_length=255)),
                ('mobile_number', models.CharField(max_length=13, unique=True, validators=[django.core.validators.RegexValidator(message="Entered mobile number isn't in a right format!", regex='^[0-9]{10,15}$')])),
                ('email_address', models.EmailField(max_length=100, unique=True)),
                ('temporary_address', models.CharField(max_length=100)),
                ('permanent_address', models.CharField(max_length=100)),
                ('profession', models.CharField(default='Not Set', max_length=50)),
                ('relation', models.CharField(default='Father', max_length=50)),
                ('gender', models.CharField(choices=[('male', 'Male'), ('female', 'Female')], max_length=10)),
                ('student', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='account.StudentUser')),
                ('type', models.OneToOneField(on_delete=django.db.models.deletion.DO_NOTHING, to='result.ParentType')),
            ],
        ),
        migrations.CreateModel(
            name='SubTeacher',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('subject_fk', models.ForeignKey(on_delete=django.db.models.deletion.DO_NOTHING, to='result.SubjectClass')),
                ('teacher_id', models.ForeignKey(on_delete=django.db.models.deletion.DO_NOTHING, to='account.TeacherUser')),
            ],
            options={
                'verbose_name_plural': 'Subject and Teacher',
                'unique_together': {('subject_fk', 'teacher_id')},
            },
        ),
        migrations.CreateModel(
            name='StudentTeacher',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('students_id', models.ForeignKey(on_delete=django.db.models.deletion.DO_NOTHING, to='account.StudentUser')),
                ('teachers_id', models.ForeignKey(on_delete=django.db.models.deletion.DO_NOTHING, to='account.TeacherUser')),
            ],
            options={
                'verbose_name_plural': 'Student and Teacher',
                'unique_together': {('students_id', 'teachers_id')},
            },
        ),
        migrations.CreateModel(
            name='Result',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('exam_score', models.DecimalField(decimal_places=2, max_digits=100, validators=[django.core.validators.MaxValueValidator(90), django.core.validators.MinValueValidator(0)])),
                ('test_score', models.DecimalField(decimal_places=2, max_digits=100, validators=[django.core.validators.MaxValueValidator(10), django.core.validators.MinValueValidator(0)])),
                ('classes', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='result.Class')),
                ('exam', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='result.Exam')),
                ('student_code', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='account.StudentUser')),
                ('subject_number', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='result.Subject')),
                ('teacher_code', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='account.TeacherUser')),
            ],
            options={
                'verbose_name_plural': 'Result',
                'unique_together': {('subject_number', 'teacher_code', 'student_code', 'exam', 'classes')},
            },
        ),
    ]
