# -*- coding: utf-8 -*-
# Generated by Django 1.11.8 on 2017-12-06 13:40
from __future__ import unicode_literals

from django.db import migrations


def update_lep_and_da_groups(apps, schema_editor):
    Group = apps.get_model('auth', 'Group')
    Permission = apps.get_model('auth', 'Permission')

    permissions_to_add = Permission.objects.filter(codename__in=(
        'add_investmentproject',
        'change_associated_investmentproject',
        'read_associated_investmentproject',
    ))

    for group_name in ('LEP', 'DA'):
        try:
            group = Group.objects.get(name=group_name)
            group.permissions.add(*permissions_to_add)
        except Group.DoesNotExist:
            pass


class Migration(migrations.Migration):

    dependencies = [
        ('core', '0001_squashed_0007_auto_20170404_1828'),
        ('investment', '0001_squashed_0063_add_created_on_id_index'),
    ]

    operations = [
        migrations.RunPython(update_lep_and_da_groups, migrations.RunPython.noop, elidable=True),
    ]

# -*- coding: utf-8 -*-
# Generated by Django 1.11.8 on 2017-12-06 13:40
from __future__ import unicode_literals

from django.db import migrations


def update_lep_and_da_groups(apps, schema_editor):
    Group = apps.get_model('auth', 'Group')
    Permission = apps.get_model('auth', 'Permission')

    permissions_to_add = Permission.objects.filter(codename__in=(
        'add_investmentproject',
        'change_associated_investmentproject',
        'read_associated_investmentproject',
    ))

    for group_name in ('LEP', 'DA'):
        try:
            group = Group.objects.get(name=group_name)
            group.permissions.add(*permissions_to_add)
        except Group.DoesNotExist:
            pass


class Migration(migrations.Migration):

    dependencies = [
        ('core', '0001_squashed_0007_auto_20170404_1828'),
        ('investment', '0001_squashed_0063_add_created_on_id_index'),
    ]

    operations = [
        migrations.RunPython(update_lep_and_da_groups, migrations.RunPython.noop, elidable=True),
    ]

# -*- coding: utf-8 -*- # Generated by Django 1.11.8 on 2017-12-06 13:40