# Generated by Django 2.2.12 on 2020-06-11 09:55

import django.db.models.deletion
import modelcluster.fields
from django.db import migrations, models

from rca.people.models import AreaOfExpertise
from rca.utils.models import ResearchType


class Migration(migrations.Migration):

    dependencies = [
        ("utils", "0014_add_research_type_slug"),
        ("projects", "0014_make_research_type_orderable"),
        ("people", "0009_areaofexpertise_slug"),
    ]

    def populate_taxonomy_slugs(apps, schema_editor):
        """Call save on the following taxonomies to populate
        slug values"""
        research_types = ResearchType.objects.all()
        expertise_types = AreaOfExpertise.objects.all()
        for type in research_types:
            type.save()
        for type in expertise_types:
            type.save()

    operations = [
        migrations.RunPython(populate_taxonomy_slugs),
    ]
