# Generated by Django 2.1 on 2018-09-06 15:46

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


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name='Event',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('title', models.CharField(max_length=256, verbose_name='Название события')),
                ('description', models.TextField(blank=True, default='', verbose_name='Описание события')),
                ('status', models.CharField(choices=[('h', 'Скрыт'), ('p', 'Опубликован')], default='h', max_length=1, verbose_name='Статус публикации')),
                ('_startdate', models.DateTimeField(blank=True, null=True, verbose_name='Начало события')),
                ('_enddate', models.DateTimeField(blank=True, null=True, verbose_name='Конец события')),
            ],
            options={
                'verbose_name': 'событие',
                'verbose_name_plural': 'события',
            },
        ),
        migrations.CreateModel(
            name='EventFile',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('file', models.FileField(upload_to='files/%Y/%m/%d')),
                ('event', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='files', to='core.Event')),
            ],
        ),
        migrations.CreateModel(
            name='EventImage',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('image', models.FileField(upload_to='images/%Y/%m/%d')),
                ('event', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='images', to='core.Event')),
            ],
        ),
        migrations.CreateModel(
            name='EventUserRegistration',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('role', models.CharField(choices=[('student', 'Студент'), ('staff', 'Преподаватель'), ('admin', 'Администратор')], max_length=8, verbose_name='Роль')),
                ('event', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.Event', verbose_name='Событие')),
            ],
        ),
        migrations.CreateModel(
            name='Person',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('first_name', models.CharField(blank=True, default='', max_length=32, verbose_name='Имя пользователя')),
                ('last_name', models.CharField(blank=True, default='', max_length=32, verbose_name='Фамилия пользователя')),
                ('second_name', models.CharField(blank=True, default='', max_length=32, verbose_name='Отчество пользователя')),
                ('sex', models.CharField(choices=[('U', 'Не выбран'), ('F', 'Женский'), ('M', 'Мужской')], default='U', max_length=1)),
                ('department', models.CharField(blank=True, max_length=1024, null=True, verbose_name='Кафедра/Институт')),
                ('group_number', models.CharField(blank=True, max_length=1024, null=True, verbose_name='Номер группы')),
                ('institute', models.CharField(blank=True, max_length=1024, null=True, verbose_name='Институт/Университет')),
                ('user', models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'verbose_name': 'персона',
                'verbose_name_plural': 'персоны',
            },
        ),
        migrations.CreateModel(
            name='Project',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('title', models.CharField(max_length=256, verbose_name='Название проекта')),
                ('description', models.TextField(blank=True, default='', verbose_name='Описание проекта')),
                ('status', models.CharField(choices=[('h', 'Скрыт'), ('p', 'Опубликован')], default='h', max_length=1, verbose_name='Статус публикации')),
                ('_startdate', models.DateTimeField(blank=True, null=True, verbose_name='Начало проекта')),
                ('_enddate', models.DateTimeField(blank=True, null=True, verbose_name='Конец проекта')),
                ('events', models.ManyToManyField(blank=True, to='core.Event')),
            ],
            options={
                'verbose_name': 'проект',
                'verbose_name_plural': 'проекты',
            },
        ),
        migrations.CreateModel(
            name='ProjectFile',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('file', models.FileField(upload_to='files/%Y/%m/%d')),
                ('project', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='files', to='core.Project')),
            ],
        ),
        migrations.CreateModel(
            name='ProjectImage',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('image', models.FileField(upload_to='images/%Y/%m/%d')),
                ('project', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='images', to='core.Project')),
            ],
        ),
        migrations.CreateModel(
            name='ProjectUserRegistration',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('role', models.CharField(choices=[('student', 'Студент'), ('staff', 'Преподаватель'), ('admin', 'Администратор')], max_length=8, verbose_name='Тип регистрации')),
                ('person', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.Person', verbose_name='Персона')),
                ('project', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.Project', verbose_name='Событие')),
            ],
        ),
        migrations.CreateModel(
            name='Subevent',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('title', models.CharField(max_length=256, verbose_name='Название события')),
                ('description', models.TextField(blank=True, default='', verbose_name='Описание события')),
                ('status', models.CharField(choices=[('h', 'Скрыт'), ('p', 'Опубликован')], default='h', max_length=1, verbose_name='Статус публикации')),
                ('_startdate', models.DateTimeField(blank=True, null=True, verbose_name='Начало события')),
                ('_enddate', models.DateTimeField(blank=True, null=True, verbose_name='Конец события')),
            ],
        ),
        migrations.AddField(
            model_name='eventuserregistration',
            name='person',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.Person', verbose_name='Персона'),
        ),
        migrations.AddField(
            model_name='event',
            name='subevents',
            field=models.ManyToManyField(blank=True, to='core.Subevent'),
        ),
        migrations.AlterUniqueTogether(
            name='projectuserregistration',
            unique_together={('person', 'project')},
        ),
        migrations.AlterUniqueTogether(
            name='eventuserregistration',
            unique_together={('person', 'event')},
        ),
    ]
