# -*- coding: utf-8 -*-
# Generated by Django 1.11.3 on 2017-07-28 15:41
from __future__ import unicode_literals

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')),
                ('first_name', models.CharField(max_length=50)),
                ('last_name', models.CharField(max_length=50)),
            ],
        ),
        migrations.CreateModel(
            name='Book',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('title', models.CharField(max_length=300)),
                ('year', models.CharField(max_length=4)),
                ('isbn', models.CharField(help_text='13 or 10 Character. <a href="https://www.isbn-international.org/content/what-isbn">ISBN number</a>', max_length=13)),
                ('publisher', models.CharField(max_length=200)),
                ('cover', models.ImageField(upload_to='uploads/book_covers/%Y/%m/')),
                ('status', models.CharField(choices=[('UNREAD', 'Unread'), ('TOREAD', 'To read'), ('READING', 'Reading'), ('READ', 'Read')], default='UNREAD', max_length=7)),
                ('date_added', models.DateField(auto_now_add=True)),
                ('last_modified', models.DateField(auto_now=True)),
                ('author', models.ManyToManyField(help_text='Select the author(s) for this book.', to='library.Author')),
            ],
        ),
        migrations.CreateModel(
            name='Genre',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=20, unique=True)),
                ('date_added', models.DateField(auto_now_add=True)),
                ('added_by', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.CreateModel(
            name='Review',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('review', models.TextField(max_length=800)),
                ('rating', models.CharField(choices=[('NOT_RATED', 'Not Rated'), ('ONE', 1), ('TWO', 2), ('THREE', 3), ('FOUR', 4), ('FIVE', 5)], default='NOT_RATED', max_length=9)),
                ('date_added', models.DateField(auto_now_add=True)),
                ('last_modified', models.DateField(auto_now=True)),
                ('added_by', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
                ('book', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='library.Book')),
            ],
        ),
        migrations.AddField(
            model_name='book',
            name='genre',
            field=models.ManyToManyField(help_text='Select the genre(s) of this book.', to='library.Genre'),
        ),
        migrations.AddField(
            model_name='book',
            name='owner',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL),
        ),
        migrations.AlterUniqueTogether(
            name='book',
            unique_together=set([('title', 'owner')]),
        ),
    ]
