# Generated by Django 2.1 on 2019-06-29 05:59

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='Author',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=255, verbose_name='Ф.И.О.')),
                ('birth_date', models.DateField(blank=True, null=True, verbose_name='дата рождения')),
                ('death_date', models.DateField(blank=True, null=True, verbose_name='дата смерти')),
                ('biography', models.TextField(blank=True, max_length=2000, null=True, verbose_name='Биография')),
                ('photo', models.ImageField(blank=True, null=True, upload_to='', verbose_name='Фотография')),
            ],
        ),
        migrations.CreateModel(
            name='Book',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=255, verbose_name='Название')),
                ('year_publishing', models.CharField(max_length=255, verbose_name='Год издания')),
                ('file', models.FileField(blank=True, null=True, upload_to='', verbose_name='Файл')),
                ('cover', models.ImageField(blank=True, null=True, upload_to='', verbose_name='Обложка')),
                ('description', models.TextField(blank=True, max_length=2000, null=True, verbose_name='Описание')),
                ('author', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='books', to='webapp.Author', verbose_name='Автор')),
            ],
        ),
        migrations.CreateModel(
            name='BookShelf',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('book', models.ManyToManyField(related_name='book_shelfs', to='webapp.Book', verbose_name='Книги')),
            ],
        ),
        migrations.CreateModel(
            name='Review',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('сontent', models.TextField(max_length=2000, verbose_name='Отзыв')),
                ('creation_date', models.DateTimeField(verbose_name='Дата создания')),
                ('book', models.ManyToManyField(related_name='reviews', to='webapp.Book', verbose_name='Книги')),
            ],
        ),
        migrations.CreateModel(
            name='UserInfo',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=255, verbose_name='Ф.И.О.')),
                ('email', models.EmailField(max_length=50, verbose_name='Почта')),
                ('user', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='info', to=settings.AUTH_USER_MODEL, verbose_name='Пользователь')),
            ],
        ),
        migrations.AddField(
            model_name='review',
            name='user',
            field=models.ManyToManyField(related_name='reviews', to='webapp.UserInfo', verbose_name='Пользователи'),
        ),
        migrations.AddField(
            model_name='bookshelf',
            name='user',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='book_shelfs', to='webapp.UserInfo', verbose_name='Пользователь'),
        ),
    ]
