# Generated by Django 2.0.7 on 2018-07-17 15:10

from django.db import migrations
from django.utils.text import slugify


def populate_slug_fields(apps, schema_editor):
    MeetingType = apps.get_model('aafinder', 'MeetingType')
    mt = MeetingType.objects.all()
    for m in mt:
        m.slug = slugify(m.type)
        m.save()
    MeetingArea = apps.get_model('aafinder', 'MeetingArea')
    mt = MeetingArea.objects.all()
    for m in mt:
        m.slug = slugify(m.area)
        m.save()


def depopulate_slug_fields():
    pass


class Migration(migrations.Migration):

    dependencies = [
        ('aafinder', '0004_add_slug_field'),
    ]

    operations = [
        migrations.RunPython(
            populate_slug_fields,
            depopulate_slug_fields
        ),
    ]
