<reponame>georiviere/Georiviere-admin<gh_stars>1-10
# Generated by Django 3.1.6 on 2021-08-23 11:56

import datetime
from django.db import migrations, models
import django.db.models.deletion
import geotrek.authent.models
import geotrek.zoning.mixins
import georiviere.watershed.mixins


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('authent', '0005_remove_userprofile_language'),
        ('maintenance', '0002_auto_20210802_1548'),
        ('contenttypes', '0002_remove_content_type_name'),
    ]

    operations = [
        migrations.CreateModel(
            name='AdministrativeFile',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('date_insert', models.DateTimeField(auto_now_add=True, verbose_name='Insertion date')),
                ('date_update', models.DateTimeField(auto_now=True, db_index=True, verbose_name='Update date')),
                ('name', models.CharField(max_length=128, verbose_name='Name')),
                ('description', models.TextField(blank=True, verbose_name='Description')),
                ('begin_date', models.DateField(default=datetime.datetime.now, verbose_name='Begin date')),
                ('end_date', models.DateField(blank=True, null=True, verbose_name='End date')),
                ('constraints', models.TextField(blank=True, help_text='Specific conditions, etc.', verbose_name='Constraints')),
                ('global_cost', models.FloatField(blank=True, default=0, help_text='€', null=True, verbose_name='Global cost')),
                ('eid', models.CharField(blank=True, max_length=1024, null=True, verbose_name='External id')),
            ],
            options={
                'verbose_name': 'Administrative file',
                'verbose_name_plural': 'Administrative files',
                'ordering': ['-begin_date', 'name'],
            },
            bases=(georiviere.watershed.mixins.WatershedPropertiesMixin, geotrek.zoning.mixins.ZoningPropertiesMixin, models.Model),
        ),
        migrations.CreateModel(
            name='Organism',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=128, verbose_name='Organism')),
                ('structure', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='authent.structure', verbose_name='Related structure')),
            ],
            options={
                'verbose_name': 'Organism',
                'verbose_name_plural': 'Organisms',
                'ordering': ['name'],
            },
        ),
        migrations.CreateModel(
            name='Funding',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('amount', models.FloatField(verbose_name='Amount')),
                ('administrative_file', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='finances_administration.administrativefile', verbose_name='Administrative file')),
                ('organism', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='finances_administration.organism', verbose_name='Organism')),
            ],
            options={
                'verbose_name': 'Funding',
                'verbose_name_plural': 'Fundings',
            },
        ),
        migrations.CreateModel(
            name='AdministrativeOperation',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('object_id', models.PositiveIntegerField()),
                ('administrative_file', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='operations', to='finances_administration.administrativefile', verbose_name='Administrative file')),
                ('content_type', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='contenttypes.contenttype')),
                ('operation_status', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='maintenance.interventionstatus', verbose_name='Status')),
            ],
            options={
                'verbose_name': 'Administrative operation',
                'verbose_name_plural': 'Administrative operations',
            },
        ),
        migrations.CreateModel(
            name='AdministrativeFileType',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('label', models.CharField(max_length=128, verbose_name='Label')),
                ('structure', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='authent.structure', verbose_name='Related structure')),
            ],
            options={
                'verbose_name': 'Admin file type',
                'verbose_name_plural': 'Admin file types',
                'ordering': ['label'],
            },
        ),
        migrations.CreateModel(
            name='AdministrativeFileDomain',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('label', models.CharField(max_length=128, verbose_name='Label')),
                ('structure', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='authent.structure', verbose_name='Related structure')),
            ],
            options={
                'verbose_name': 'Admin file domain',
                'verbose_name_plural': 'Admin file domains',
                'ordering': ['label'],
            },
        ),
        migrations.AddField(
            model_name='administrativefile',
            name='adminfile_type',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='finances_administration.administrativefiletype', verbose_name='Admin file type'),
        ),
        migrations.AddField(
            model_name='administrativefile',
            name='contractors',
            field=models.ManyToManyField(blank=True, related_name='projects', to='finances_administration.Organism', verbose_name='Contractors'),
        ),
        migrations.AddField(
            model_name='administrativefile',
            name='domain',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='finances_administration.administrativefiledomain', verbose_name='Admin file domain'),
        ),
        migrations.AddField(
            model_name='administrativefile',
            name='funders',
            field=models.ManyToManyField(through='finances_administration.Funding', to='finances_administration.Organism', verbose_name='Funders'),
        ),
        migrations.AddField(
            model_name='administrativefile',
            name='project_managers',
            field=models.ManyToManyField(blank=True, related_name='manages', to='finances_administration.Organism', verbose_name='Project managers'),
        ),
        migrations.AddField(
            model_name='administrativefile',
            name='project_owners',
            field=models.ManyToManyField(blank=True, related_name='owns', to='finances_administration.Organism', verbose_name='Project owners'),
        ),
        migrations.AddField(
            model_name='administrativefile',
            name='structure',
            field=models.ForeignKey(default=geotrek.authent.models.default_structure_pk, on_delete=django.db.models.deletion.CASCADE, to='authent.structure', verbose_name='Related structure'),
        ),
    ]
