# Generated by Django 2.2.2 on 2019-06-21 19:54

from django.db import migrations


def move_links(apps, schema_editor):
    AssignedContent = apps.get_model("spider_base", "AssignedContent")
    LinkContent = apps.get_model("spider_base", "LinkContent")

    for i in AssignedContent.objects.filter(
        ctype__name="Link"
    ):
        content = LinkContent.objects.get(id=i.object_id)
        i.attached_to_content = content.content
        i.save(update_fields=["attached_to_content"])


class Migration(migrations.Migration):

    dependencies = [
        ('spider_base', '0002_20190518_squashed'),
        ('contenttypes', '0002_remove_content_type_name'),
    ]

    operations = [
        migrations.RunPython(move_links),
    ]
