# -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2016-03-29 12:59
from __future__ import unicode_literals

from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import django_markdown.models
import smart_selects.db_fields


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('repositories', '0001_initial'),
        ('places', '0001_initial'),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name='Manuscript',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created', models.DateTimeField(auto_now_add=True)),
                ('modified', models.DateTimeField(auto_now=True)),
                ('shelfmark', models.CharField(blank=True, max_length=100, null=True)),
                ('number', models.CharField(blank=True, max_length=30, null=True)),
                ('olim', models.CharField(blank=True, max_length=100, null=True)),
                ('date_earliest', models.CharField(blank=True, max_length=100, null=True)),
                ('date_latest', models.CharField(blank=True, max_length=100, null=True)),
                ('date', models.CharField(blank=True, max_length=50, null=True)),
                ('saeculo', models.CharField(blank=True, max_length=50, null=True)),
                ('material', models.CharField(blank=True, choices=[('parcment', 'Parchment'), ('paper', 'Paper')], max_length=50, null=True)),
                ('width', models.FloatField(blank=True, null=True, verbose_name='Width (in mm.)')),
                ('height', models.FloatField(blank=True, null=True, verbose_name='Height (in mm.)')),
                ('dimension_note', models.CharField(blank=True, max_length=255, null=True, verbose_name='Note about dimensions')),
                ('folios', models.CharField(blank=True, max_length=250, null=True)),
                ('layout', django_markdown.models.MarkdownField(blank=True, null=True)),
                ('script', django_markdown.models.MarkdownField(blank=True, null=True)),
                ('annotation', django_markdown.models.MarkdownField(blank=True, null=True)),
                ('note', django_markdown.models.MarkdownField(blank=True, null=True)),
                ('literature', django_markdown.models.MarkdownField(blank=True, null=True)),
                ('country', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='places.Country')),
                ('library', smart_selects.db_fields.ChainedForeignKey(auto_choose=True, chained_field='town', chained_model_field='library_town', on_delete=django.db.models.deletion.CASCADE, related_name='library', to='places.Library')),
            ],
            options={
                'ordering': ['town', 'library', 'shelfmark', 'number'],
            },
        ),
        migrations.CreateModel(
            name='ManuscriptInspection',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created', models.DateTimeField(auto_now_add=True)),
                ('modified', models.DateTimeField(auto_now=True)),
                ('inspection_type', models.CharField(choices=[('digital', 'Digital reproduction'), ('situ', 'In situ')], max_length=10)),
                ('inspection_date', models.DateField()),
                ('inspector', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
                ('manuscript', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='manuscripts.Manuscript')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='ManuscriptOrigin',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created', models.DateTimeField(auto_now_add=True)),
                ('modified', models.DateTimeField(auto_now=True)),
                ('dubious', models.BooleanField(default=False)),
                ('origin_country', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='places.Country')),
                ('origin_town', smart_selects.db_fields.ChainedForeignKey(auto_choose=True, blank=True, chained_field='origin_country', chained_model_field='country', null=True, on_delete=django.db.models.deletion.CASCADE, related_name='origin_town', to='places.Town')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='OnlineMaterial',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created', models.DateTimeField(auto_now_add=True)),
                ('modified', models.DateTimeField(auto_now=True)),
                ('url', models.URLField(null=True)),
                ('manuscript', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='manuscripts.Manuscript')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='Reproduction',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created', models.DateTimeField(auto_now_add=True)),
                ('modified', models.DateTimeField(auto_now=True)),
                ('media', models.CharField(choices=[('digital', 'Digital'), ('microfilm', 'Micro film')], max_length=100)),
                ('referencenumber', models.CharField(blank=True, max_length=255, null=True)),
                ('url', models.URLField(blank=True, null=True)),
                ('archive', models.ForeignKey(max_length=255, on_delete=django.db.models.deletion.CASCADE, to='repositories.Archive')),
                ('manuscript', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='manuscripts.Manuscript')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.AddField(
            model_name='manuscript',
            name='origin',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='origin', to='manuscripts.ManuscriptOrigin'),
        ),
        migrations.AddField(
            model_name='manuscript',
            name='town',
            field=smart_selects.db_fields.ChainedForeignKey(auto_choose=True, chained_field='country', chained_model_field='country', on_delete=django.db.models.deletion.CASCADE, related_name='town', to='places.Town'),
        ),
        migrations.AlterUniqueTogether(
            name='manuscript',
            unique_together=set([('country', 'town', 'library', 'shelfmark', 'number')]),
        ),
    ]
