# -*- coding: utf-8 -*-
# Generated by Django 1.10.3 on 2017-03-22 20:50
#
# Goes through and deletes the one bad character Tara found
#
#########################################################
from __future__ import unicode_literals

from django.db import migrations


def delete_char_bad_char(apps) -> None:
    Chars_back = apps.get_model('calligraphy', 'Character_orig')
    Chars =      apps.get_model('calligraphy', 'Character')
    CharSet =    apps.get_model('calligraphy', 'CharSet')
    
    for charset in CharSet.objects.all():
        if charset.set_valid is False:
            for ochar in charset.set_chars_orig.all():
                char = Chars.objects.get(id=ochar.id)
                char.delete()

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


class Migration(migrations.Migration):

    dependencies = [
        ('calligraphy', '0093_auto_20170322_1904'),
    ]

    operations = [ migrations.RunPython(do_stuff)
    ]
