# -*- coding: utf-8 -*-
# Generated by Django 1.9.11 on 2017-02-17 07:18
from __future__ import unicode_literals

from django.db import migrations, models


class Migration(migrations.Migration):

    dependencies = [
        ('aims', '0009_merge'),
    ]

    def set_national_sectors(apps, schema_editor):
        SectorCategory = apps.get_model('aims', 'SectorCategory')
        Sector = apps.get_model('aims', 'Sector')
        mmswg, created = SectorCategory.objects.get_or_create(name="Local Sectors", code=1, openly_type='national')
        Sector.objects.filter(category__isnull=True).update(category=mmswg)

    operations = [
        migrations.CreateModel(
            name='IATISector',
            fields=[
            ],
            options={
                'proxy': True,
            },
            bases=('aims.sector',),
        ),
        migrations.CreateModel(
            name='IATISectorCategory',
            fields=[
            ],
            options={
                'proxy': True,
            },
            bases=('aims.sectorcategory',),
        ),
        migrations.CreateModel(
            name='NationalSector',
            fields=[
            ],
            options={
                'proxy': True,
            },
            bases=('aims.sector',),
        ),
        migrations.CreateModel(
            name='NationalSectorCategory',
            fields=[
            ],
            options={
                'proxy': True,
            },
            bases=('aims.sectorcategory',),
        ),
        migrations.AddField(
            model_name='sectorcategory',
            name='openly_type',
            field=models.CharField(choices=[('iati', 'Iati Codelist Sector'), ('national', 'National Sector')], default='iati', max_length=8),
        ),
        migrations.RunPython(set_national_sectors),
    ]
