# Generated by Django 2.0.1 on 2018-02-26 21:18

from django.db import migrations
from geo.models import Region


def set_regions(apps, schema_editor):
    with open('geo.txt', 'r', encoding='utf-8') as f:
        for line in f.readlines():
            data = line.split('%%')
            print('-' * 20, data[0], data[1].replace('\n', ''))
            region = Region(
                title=data[0],
                code=data[1].replace('\n', ''),
            )
            region.save()


class Migration(migrations.Migration):

    dependencies = [
        ('geo', '0010_auto_20180202_2154'),
    ]

    operations = [
        migrations.RunPython(set_regions)
    ]
