# Generated by Django 2.2.9 on 2020-02-17 10:31

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


def set_slugs(apps, schema_editor):
    Theme = apps.get_model("categories", "Theme")
    for theme in Theme.objects.all():
        theme.slug = slugify(theme.name)
        theme.save()

    Category = apps.get_model("categories", "Category")
    for category in Category.objects.all():
        category.slug = slugify(category.name)
        category.save()


class Migration(migrations.Migration):

    dependencies = [
        ("categories", "0002_auto_20200217_1131"),
    ]

    operations = [
        migrations.RunPython(set_slugs),
    ]
