<|file_name|>0208_create_role_executive.py<|end_file_name|><｜fim▁begin｜># -*- coding: utf-8 -*-
# Generated by Django 1.11.2 on 2017-11-22 07:11
from __future__ import unicode_literals

from django.core.management.sql import emit_post_migrate_signal
from django.db import migrations


def add_executive_group(apps, schema_editor):
    # create group
    <|fim_middle|>



class Migration(migrations.Migration):
    dependencies = [
        ('base', '0207_auto_20171220_1035'),
    ]

    operations = [
        migrations.RunPython(add_executive_group, elidable=True),
    ]
<｜fim▁end｜>
    db_alias = schema_editor.connection.alias
    emit_post_migrate_signal(1, False, db_alias)
    Group = apps.get_model('auth', 'Group')
    Permission = apps.get_model('auth', 'Permission')
    executive_group, created = Group.objects.get_or_create(name='executive')
    if created:
        # Learning unit
        can_access_learningunit = Permission.objects.get(codename='can_access_learningunit')
        executive_group.permissions.add(can_access_learningunit)