# -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2018-09-17 05:27
from __future__ import unicode_literals

from django.db import migrations


def populate_role(apps, schema_editor):
    MediaSpec = apps.get_model('edegal', 'MediaSpec')
    MediaSpec.objects.filter(is_default_thumbnail=False).update(role='preview')
    MediaSpec.objects.filter(is_default_thumbnail=True).update(role='thumbnail')

    Media = apps.get_model('edegal', 'Media')
    Media.objects.filter(spec__isnull=True).update(role='original')
    Media.objects.filter(spec__role='preview').update(role='preview')
    Media.objects.filter(spec__role='thumbnail').update(role='thumbnail')


class Migration(migrations.Migration):
    dependencies = [
        ('edegal', '0005_media_role'),
    ]

    operations = [
        migrations.RunPython(populate_role)
    ]

# -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2018-09-17 05:27
from __future__ import unicode_literals

from django.db import migrations


def populate_role(apps, schema_editor):
    MediaSpec = apps.get_model('edegal', 'MediaSpec')
    MediaSpec.objects.filter(is_default_thumbnail=False).update(role='preview')
    MediaSpec.objects.filter(is_default_thumbnail=True).update(role='thumbnail')

    Media = apps.get_model('edegal', 'Media')
    Media.objects.filter(spec__isnull=True).update(role='original')
    Media.objects.filter(spec__role='preview').update(role='preview')
    Media.objects.filter(spec__role='thumbnail').update(role='thumbnail')


class Migration(migrations.Migration):
    dependencies = [
        ('edegal', '0005_media_role'),
    ]

    operations = [
        migrations.RunPython(populate_role)
    ]

# -*- coding: utf-8 -*- # Generated by Django 1.11 on 2018-09-17 05:27