# -*- coding: utf-8 -*-
# Generated by Django 1.11.2 on 2017-07-13 10:31
from __future__ import unicode_literals

from django.db import migrations, models


def convert_stuffed_area_to_location_group(apps, schema_editor):
    LocationGroupCategory = apps.get_model('mapdata', 'LocationGroupCategory')
    Area = apps.get_model('mapdata', 'Area')

    category = LocationGroupCategory.objects.get(name='groups')
    group = category.groups.create(can_search=False, can_describe=False, color='rgba(0, 0, 0, 0.04)', titles={
        'en': 'Stuffed area',
        'de': 'Vollgestopfter Bereich',
    }, priority=-1)
    group.areas.set(Area.objects.filter(stuffed=True))


class Migration(migrations.Migration):

    dependencies = [
        ('mapdata', '0024_remove_compiled_room_area'),
    ]

    operations = [
        migrations.AlterField(
            model_name='locationgroup',
            name='color',
            field=models.CharField(blank=True, max_length=32, null=True, verbose_name='background color'),
        ),
        migrations.RunPython(convert_stuffed_area_to_location_group),
        migrations.RemoveField(
            model_name='area',
            name='stuffed',
        ),
    ]
