# Generated by Django 2.0.5 on 2018-05-29 10:24

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


class Migration(migrations.Migration):

    initial = True

    dependencies = [
    ]

    operations = [
        migrations.CreateModel(
            name='Autor',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('nombre', models.CharField(help_text='Nombre del autor', max_length=100)),
                ('apellido_1', models.CharField(help_text='Apellido (el primero si hay más de uno)', max_length=100)),
                ('apellido_2', models.CharField(blank=True, help_text='Segundo apellido (si procede)', max_length=100, null=True)),
                ('nacimiento', models.DateField(blank=True, null=True, verbose_name='Fecha de nacimiento')),
                ('defuncion', models.DateField(blank=True, null=True, verbose_name='Fecha de fallecimiento')),
            ],
        ),
        migrations.CreateModel(
            name='Escrito',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('autor', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='biblioteca.Autor')),
            ],
        ),
        migrations.CreateModel(
            name='Genero',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('genero', models.CharField(help_text='Introduce un nombre de genero (Poesia, Ciencia Ficcion, Ensayo, ...', max_length=50)),
            ],
        ),
        migrations.CreateModel(
            name='Idioma',
            fields=[
                ('idioma', models.CharField(help_text='Introduce un nombre de idioma', max_length=50)),
                ('codigo', models.CharField(help_text='Introduce un código de idioma (ISO 639-1)', max_length=2, primary_key=True, serialize=False)),
            ],
        ),
        migrations.CreateModel(
            name='Libro',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('titulo', models.CharField(help_text='Titulo del libro', max_length=200)),
                ('sinopsis', models.TextField(blank=True, help_text='Breve resumen del argumento', verbose_name='Sinopis del libro')),
                ('isbn', models.CharField(max_length=13)),
                ('autores', models.ManyToManyField(blank=True, through='biblioteca.Escrito', to='biblioteca.Autor')),
                ('genero', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='biblioteca.Genero')),
                ('idioma', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='biblioteca.Idioma')),
            ],
        ),
        migrations.AddField(
            model_name='escrito',
            name='libro',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='biblioteca.Libro'),
        ),
        migrations.AddField(
            model_name='autor',
            name='libros',
            field=models.ManyToManyField(blank=True, through='biblioteca.Escrito', to='biblioteca.Libro'),
        ),
    ]
