# Generated by Django 3.1 on 2021-01-08 16:11

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


class Migration(migrations.Migration):

    initial = True

    dependencies = [
    ]

    operations = [
        migrations.CreateModel(
            name='Categories',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(db_index=True, max_length=200, verbose_name='Название категории')),
                ('slug', models.SlugField(unique=True)),
            ],
            options={
                'verbose_name': 'Категория',
                'ordering': ['name'],
            },
        ),
        migrations.CreateModel(
            name='Genres',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(db_index=True, max_length=200, verbose_name='Название жанра')),
                ('slug', models.SlugField(unique=True)),
            ],
            options={
                'verbose_name': 'Жанр',
                'ordering': ['name'],
            },
        ),
        migrations.CreateModel(
            name='Titles',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(db_index=True, max_length=200, verbose_name='Название произведения')),
                ('year', models.PositiveIntegerField(db_index=True, default=2021, validators=[django.core.validators.MinValueValidator(1450), titles.models.max_value_current_year], verbose_name='Дата публикации произведения')),
                ('description', models.TextField(blank=True, null=True)),
                ('rating', models.IntegerField(blank=True, null=True)),
                ('category', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='titles.categories', verbose_name='Категория произведения')),
                ('genre', models.ManyToManyField(blank=True, to='titles.Genres', verbose_name='Жанр')),
            ],
        ),
    ]
