# -*- coding: utf-8 -*-
# Generated by Django 1.10.3 on 2017-03-22 16:01
#
# Links Characters to parent so we can later keep track of merged characters
#
#
###########################################################################
from __future__ import unicode_literals

from django.db import migrations

def add_ref(apps) -> None:
     Chars_back = apps.get_model('calligraphy', 'Character_orig')
     for char in apps.get_model('calligraphy', 'Character').objects.all():
         char.char_parents.add(Chars_back.objects.get(id=char.id))
         char.save()

def do_stuff(apps, schemd_editor) -> None:
    add_ref(apps)

class Migration(migrations.Migration):

    dependencies = [
        ('calligraphy', '0087_character_char_parents'),
    ]

    operations = [ migrations.RunPython(do_stuff)
    ]
