# Generated by Django 2.0.9 on 2018-11-21 10:08

from django.conf import settings
import django.contrib.postgres.fields.jsonb
from django.db import migrations, models
import django.db.models.deletion
import versatileimagefield.fields


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('terra', '0015_auto_20181005_1302'),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name='Campaign',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('label', models.CharField(max_length=100, verbose_name='Label')),
                ('assignee', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='assigned_campaigns', to=settings.AUTH_USER_MODEL, verbose_name='Assigned to')),
                ('owner', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='campaigns', to=settings.AUTH_USER_MODEL, verbose_name='Owner')),
            ],
            options={
                'ordering': ['-created_at'],
                'permissions': (('manage_all_campaigns', 'Can manage all campaigns'),),
            },
        ),
        migrations.CreateModel(
            name='Document',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('properties', django.contrib.postgres.fields.jsonb.JSONField(blank=True, default=dict, verbose_name='Properties')),
                ('file', models.FileField(upload_to='', verbose_name='File')),
                ('owner', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='documents', to=settings.AUTH_USER_MODEL, verbose_name='Owner')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='Picture',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('state', models.IntegerField(default=100, verbose_name='State')),
                ('properties', django.contrib.postgres.fields.jsonb.JSONField(blank=True, default=dict, verbose_name='Properties')),
                ('file', versatileimagefield.fields.VersatileImageField(upload_to='', verbose_name='File')),
                ('date', models.DateTimeField(verbose_name='Date')),
                ('remarks', models.TextField(max_length=350, verbose_name='Remarks')),
                ('owner', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='pictures', to=settings.AUTH_USER_MODEL, verbose_name='Owner')),
            ],
            options={
                'permissions': (('change_state_picture', 'Is able to change the picture state'),),
                'get_latest_by': 'date',
            },
        ),
        migrations.CreateModel(
            name='Theme',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('label', models.CharField(max_length=100, verbose_name='Label')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='Viewpoint',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('label', models.CharField(max_length=100, verbose_name='Label')),
                ('properties', django.contrib.postgres.fields.jsonb.JSONField(blank=True, default=dict, verbose_name='Properties')),
                ('point', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='points', to='terra.Feature')),
                ('themes', models.ManyToManyField(blank=True, related_name='viewpoints', to='tropp.Theme')),
            ],
            options={
                'ordering': ['-created_at'],
                'permissions': (('can_download_pdf', 'Is able to download a pdf document'),),
            },
        ),
        migrations.AddField(
            model_name='picture',
            name='viewpoint',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='pictures', to='tropp.Viewpoint'),
        ),
        migrations.AddField(
            model_name='document',
            name='viewpoint',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='documents', to='tropp.Viewpoint'),
        ),
        migrations.AddField(
            model_name='campaign',
            name='viewpoints',
            field=models.ManyToManyField(related_name='campaigns', to='tropp.Viewpoint'),
        ),
        migrations.AddIndex(
            model_name='picture',
            index=models.Index(fields=['viewpoint', 'date'], name='tropp_pictu_viewpoi_d2671c_idx'),
        ),
    ]
