# Generated by Django 3.2.4 on 2021-06-13 20:11

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


class Migration(migrations.Migration):

    initial = True

    dependencies = [
    ]

    operations = [
        migrations.CreateModel(
            name='Books',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('title', models.CharField(max_length=150, verbose_name='Название')),
                ('description', models.TextField(verbose_name='Описание')),
                ('cover', models.ImageField(upload_to='books_cover/', verbose_name='Обложка')),
                ('author', models.CharField(max_length=150, verbose_name='Автор')),
                ('pages', models.PositiveSmallIntegerField(default=0, verbose_name='Страниц')),
                ('year_of_release', models.PositiveSmallIntegerField(default=2005, verbose_name='Дата выхода')),
                ('url', models.SlugField(max_length=160, unique=True)),
                ('url_on_book', models.SlugField(max_length=160, unique=True)),
                ('file_book', models.FileField(default='books_pdf/1.pdf', upload_to='books_pdf/', verbose_name='Книга book_pdf')),
            ],
            options={
                'verbose_name': 'Книга',
                'verbose_name_plural': 'Книги',
            },
        ),
        migrations.CreateModel(
            name='RatingStar',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('value', models.PositiveSmallIntegerField(default=0, verbose_name='Значение')),
            ],
            options={
                'verbose_name': 'Звёзда рейтинга',
                'verbose_name_plural': 'Звёзды рейтинга',
            },
        ),
        migrations.CreateModel(
            name='Sections',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=150, verbose_name='Категория')),
                ('description', models.TextField(verbose_name='Описание')),
                ('cover', models.ImageField(blank=True, null=True, upload_to='section_cover/', verbose_name='Обложка_Раздела')),
                ('url', models.SlugField(max_length=160, unique=True)),
            ],
            options={
                'verbose_name': 'Раздел',
                'verbose_name_plural': 'Разделы',
            },
        ),
        migrations.CreateModel(
            name='Rating',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('ip', models.CharField(max_length=15, verbose_name='IP адрес')),
                ('book', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='main.books', verbose_name='книга')),
                ('star', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='main.ratingstar', verbose_name='звезда')),
            ],
            options={
                'verbose_name': 'Рейтинг',
                'verbose_name_plural': 'Рейтинги',
            },
        ),
        migrations.AddField(
            model_name='books',
            name='sections',
            field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='main.sections', verbose_name='раздел'),
        ),
    ]
