# -*- coding: utf-8 -*-
# Generated by Django 1.11.7 on 2017-11-30 17:02
from django.db import migrations, models
import django.db.models.deletion
import django_attachments.models
import easy_thumbnails.fields


class Migration(migrations.Migration):

	initial = True

	dependencies = [
	]

	operations = [
		migrations.CreateModel(
			name='Attachment',
			fields=[
				('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
				('created', models.DateTimeField(db_index=True, editable=False, verbose_name='Created')),
				('updated', models.DateTimeField(db_index=True, editable=False, verbose_name='Updated')),
				('rank', models.IntegerField(verbose_name='Rank')),
				('original_name', models.CharField(max_length=255, verbose_name='Original name')),
				('file', easy_thumbnails.fields.ThumbnailerField(upload_to=django_attachments.models.upload_path_handler, verbose_name='File')),
				('filesize', models.BigIntegerField(verbose_name='File size')),
				('mimetype', models.CharField(blank=True, max_length=200, verbose_name='File type')),
				('image_width', models.IntegerField(blank=True, null=True, verbose_name='Image width')),
				('image_height', models.IntegerField(blank=True, null=True, verbose_name='Image height')),
			],
			options={
				'verbose_name_plural': 'Attachments',
				'verbose_name': 'Attachment',
				'ordering': ('-library', 'rank'),
			},
		),
		migrations.CreateModel(
			name='Library',
			fields=[
				('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
				('created', models.DateTimeField(db_index=True, editable=False, verbose_name='Created')),
				('updated', models.DateTimeField(db_index=True, editable=False, verbose_name='Updated')),
				('title', models.CharField(blank=True, max_length=255, verbose_name='Name')),
				('primary_attachment', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='attachments_library', to='django_attachments.Attachment', verbose_name='Primary attachment')),
			],
			options={
				'verbose_name_plural': 'Libraries',
				'verbose_name': 'Library',
			},
		),
		migrations.AddField(
			model_name='attachment',
			name='library',
			field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='django_attachments.Library', verbose_name='Library'),
		),
		migrations.AlterIndexTogether(
			name='attachment',
			index_together=set([('library', 'rank')]),
		),
	]
