# -*- coding: utf-8 -*-
# Generated by Django 1.9.4 on 2016-10-08 12:34
from __future__ import unicode_literals

from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import documentcollection.models
import oxdjango.fields


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('document', '0003_new_fields'),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name='Collection',
            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)),
                ('name', models.CharField(max_length=255)),
                ('status', models.CharField(default=b'private', max_length=20)),
                ('query', oxdjango.fields.DictField(default={b'static': True})),
                ('type', models.CharField(default=b'static', max_length=255)),
                ('description', models.TextField(default=b'')),
                ('icon', models.ImageField(blank=True, default=None, upload_to=documentcollection.models.get_icon_path)),
                ('view', models.TextField(default=documentcollection.models.get_collectionview)),
                ('sort', oxdjango.fields.TupleField(default=documentcollection.models.get_collectionsort, editable=False)),
                ('poster_frames', oxdjango.fields.TupleField(default=[], editable=False)),
                ('numberofdocuments', models.IntegerField(default=0)),
            ],
        ),
        migrations.CreateModel(
            name='CollectionDocument',
            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)),
                ('index', models.IntegerField(default=0)),
                ('collection', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='documentcollection.Collection')),
                ('document', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='document.Document')),
            ],
        ),
        migrations.CreateModel(
            name='Position',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('section', models.CharField(max_length=255)),
                ('position', models.IntegerField(default=0)),
                ('collection', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='position', to='documentcollection.Collection')),
                ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='collection_positions', to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.AddField(
            model_name='collection',
            name='documents',
            field=models.ManyToManyField(related_name='collections', through='documentcollection.CollectionDocument', to='document.Document'),
        ),
        migrations.AddField(
            model_name='collection',
            name='subscribed_users',
            field=models.ManyToManyField(related_name='subscribed_collections', to=settings.AUTH_USER_MODEL),
        ),
        migrations.AddField(
            model_name='collection',
            name='user',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='collections', to=settings.AUTH_USER_MODEL),
        ),
        migrations.AlterUniqueTogether(
            name='position',
            unique_together=set([('user', 'collection', 'section')]),
        ),
        migrations.AlterUniqueTogether(
            name='collection',
            unique_together=set([('user', 'name')]),
        ),
    ]
