# Generated by Django 2.2.2 on 2019-08-09 02:06

from django.db import migrations


def to_promgen(apps, schema_editor):
    Rule = apps.get_model("promgen", "Rule")
    ContentType = apps.get_model("contenttypes", "ContentType")
    sites, _ = ContentType.objects.get_or_create(app_label="sites", model="site")
    promgen, _ = ContentType.objects.get_or_create(app_label="promgen", model="site")
    Rule.objects.filter(content_type_id=sites.id).update(content_type_id=promgen.id)


def to_sites(apps, schema_editor):
    Rule = apps.get_model("promgen", "Rule")
    ContentType = apps.get_model("contenttypes", "ContentType")
    sites, _ = ContentType.objects.get_or_create(app_label="sites", model="site")
    promgen, _ = ContentType.objects.get_or_create(app_label="promgen", model="site")
    Rule.objects.filter(content_type_id=promgen.id).update(content_type_id=sites.id)


class Migration(migrations.Migration):
    dependencies = [
        ("promgen", "0009_blackbox-module"),
        ("contenttypes", "0002_remove_content_type_name"),
    ]

    operations = [migrations.RunPython(to_promgen, to_sites)]
