# -*- coding: utf-8 -*-
# Generated by Django 1.9.12 on 2017-02-18 16:24
from django.db import migrations

countries = {
    "Ma\u010farsko": "HU",
    "Czech Republic": "CZ",
    "\u010cesk\xe1 republika": "CZ",
    "United Kingdom": "GB",
    "Austria": "AT",
    "Madarsko": "HU",
    "Australia": "AU",
    "Srbsko": "RS",
    "Kraj Vyso\u010dina, \u010cesk\xe1 republika": "CZ",
    "\u010desk\xe1 republika": "CZ",
    "\u010cR": "CZ",
    "Plze\u0148sk\xfd kraj, \u010cesk\xe1 republika": "CZ",
    "Sverige": "SE",
    "serbia": "RS",
    "\xd6sterreich": "AT",
    "Switzerland": "CH",
    "ma\u010farsk\xe1 \u013eudovo demokratick\xe1 ": "HU",
    "Kosovo": "RS",
    "India": "IN",
    "Uzbekistan": "UZ",
    "Uganda": "UG",
    "litva": "LT",
    "Velka Britania": "GB",
}


def fix_country_names(apps, schema_editor):
    # We can't import the Person model directly as it may be a newer
    # version than this migration expects. We use the historical version.
    Address = apps.get_model("people", "Address")
    for address in Address.objects.all():
        address.country = countries.get(address.country, "SK")
        address.save()


class Migration(migrations.Migration):
    dependencies = [("people", "0010_merge")]

    operations = [migrations.RunPython(fix_country_names)]

# -*- coding: utf-8 -*-
# Generated by Django 1.9.12 on 2017-02-18 16:24
from django.db import migrations

countries = {
    "Ma\u010farsko": "HU",
    "Czech Republic": "CZ",
    "\u010cesk\xe1 republika": "CZ",
    "United Kingdom": "GB",
    "Austria": "AT",
    "Madarsko": "HU",
    "Australia": "AU",
    "Srbsko": "RS",
    "Kraj Vyso\u010dina, \u010cesk\xe1 republika": "CZ",
    "\u010desk\xe1 republika": "CZ",
    "\u010cR": "CZ",
    "Plze\u0148sk\xfd kraj, \u010cesk\xe1 republika": "CZ",
    "Sverige": "SE",
    "serbia": "RS",
    "\xd6sterreich": "AT",
    "Switzerland": "CH",
    "ma\u010farsk\xe1 \u013eudovo demokratick\xe1 ": "HU",
    "Kosovo": "RS",
    "India": "IN",
    "Uzbekistan": "UZ",
    "Uganda": "UG",
    "litva": "LT",
    "Velka Britania": "GB",
}


def fix_country_names(apps, schema_editor):
    # We can't import the Person model directly as it may be a newer
    # version than this migration expects. We use the historical version.
    Address = apps.get_model("people", "Address")
    for address in Address.objects.all():
        address.country = countries.get(address.country, "SK")
        address.save()


class Migration(migrations.Migration):
    dependencies = [("people", "0010_merge")]

    operations = [migrations.RunPython(fix_country_names)]

# -*- coding: utf-8 -*- # Generated by Django 1.9.12 on 2017-02-18 16:24 # We can't import the Person model directly as it may be a newer # version than this migration expects. We use the historical version.