<reponame>tanmayagarwal/Activity-CE
# Generated by Django 2.2.4 on 2019-09-17 04:50

from django.db import migrations


def populate_default_sectors(apps, schema_editor):
    """
    Migration to populate default sectors
    :param app:
    :param schema_editor:
    :return:
    """
    Sector = apps.get_model('workflow', 'Sector')
    # List of sectors to be inserted
    sectors = ('Agriculture', 'Natural Resource Management', 'Maternal and Child Health',
               'Markets, Income, Employment', 'Disaster Risk Reduction', 'Resilience',
               'Social Protection and Inclusion', 'Good Governance', 'Camp Coordination and Camp Management',
               'Early Recovery', 'Education', 'Emergency Telecommunications', 'Food Security', 'Health',
               'Logistics', 'Nutrition', 'Protection', 'Shelter', 'Water, Sanitation, and Hygiene',
               'Cash and Voucher Assistance', 'Gender')
    for sector in sectors:
        Sector.objects.create(sector=sector)


def create_default_groups(apps, schema_editor):
    Group = apps.get_model('auth', 'Group')
    group_list = ['Owner', 'Editor', 'Viewer']
    for item in group_list:
        group = Group(name=item)
        group.save()


class Migration(migrations.Migration):

    dependencies = [
        ('workflow', '0028_auto_20190913_0716'),
    ]

    operations = [
        migrations.RunPython(populate_default_sectors),
        migrations.RunPython(create_default_groups),
    ]

# Generated by Django 2.2.4 on 2019-09-17 04:50

from django.db import migrations


def populate_default_sectors(apps, schema_editor):
    """
    Migration to populate default sectors
    :param app:
    :param schema_editor:
    :return:
    """
    Sector = apps.get_model('workflow', 'Sector')
    # List of sectors to be inserted
    sectors = ('Agriculture', 'Natural Resource Management', 'Maternal and Child Health',
               'Markets, Income, Employment', 'Disaster Risk Reduction', 'Resilience',
               'Social Protection and Inclusion', 'Good Governance', 'Camp Coordination and Camp Management',
               'Early Recovery', 'Education', 'Emergency Telecommunications', 'Food Security', 'Health',
               'Logistics', 'Nutrition', 'Protection', 'Shelter', 'Water, Sanitation, and Hygiene',
               'Cash and Voucher Assistance', 'Gender')
    for sector in sectors:
        Sector.objects.create(sector=sector)


def create_default_groups(apps, schema_editor):
    Group = apps.get_model('auth', 'Group')
    group_list = ['Owner', 'Editor', 'Viewer']
    for item in group_list:
        group = Group(name=item)
        group.save()


class Migration(migrations.Migration):

    dependencies = [
        ('workflow', '0028_auto_20190913_0716'),
    ]

    operations = [
        migrations.RunPython(populate_default_sectors),
        migrations.RunPython(create_default_groups),
    ]
# Generated by Django 2.2.4 on 2019-09-17 04:50 Migration to populate default sectors     :param app:     :param schema_editor:     :return: # List of sectors to be inserted