# Generated by Django 2.2.15 on 2020-09-20 09:14

from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone

from shutil import copytree


def zkopiruj_fotky(apps, schema_editor):
    try:
        copytree("mamweb/static/images/header/", "media/header/") # FIXME: bylo tu dirs_exists_ok=True, nekompatibilní s Py 3.7
    except FileExistsError:
        pass


class Migration(migrations.Migration):
    initial = True

    dependencies = [
    ]

    operations = [
        migrations.CreateModel(
            name='FotkaHeader',
            fields=[
                ('cas', models.DateTimeField(default=django.utils.timezone.now, help_text='Čas vložení fotky',
                                             verbose_name='čas vložení fotky')),
                ('nazev',
                 models.CharField(help_text='Název např. archiv_noc', max_length=50, primary_key=True, serialize=False,
                                  unique=True, verbose_name='název fotky')),
                ('fotka', models.ImageField(upload_to='header')),
            ],
            options={
                'verbose_name': 'fotka do pozadí menu',
                'verbose_name_plural': 'fotky do pozadí menu',
                'db_table': 'fotky_header',
                'ordering': ['-cas'],
            },
        ),
        migrations.CreateModel(
            name='FotkaUrlVazba',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('url',
                 models.CharField(blank=True, help_text='url prefix stránek např: /archiv/ nebo /', max_length=100,
                                  verbose_name='URL')),
                ('denni_doba', models.CharField(choices=[('den', 'Zobrazit jen ve dne'), ('noc', 'Zobrazit jen v noci'),
                                                         ('oboji', 'Zobrazovat pořád')], default='oboji', max_length=16,
                                                verbose_name='denní doba')),
                ('fotka', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='header_fotky.FotkaHeader',
                                            verbose_name='fotka')),
            ],
            options={
                'verbose_name': 'vazba url a fotky do pozadí menu',
                'verbose_name_plural': 'vazby url a fotek do pozadí menu',
                'db_table': 'fotky_url_vazby',
                'ordering': ['url'],
            },

        ),
        migrations.RunPython(zkopiruj_fotky, migrations.RunPython.noop),
    ]