# Generated by Django 2.0.5 on 2018-06-17 11:57

from django.contrib.auth.management import create_permissions
from django.db import migrations
from django.contrib.contenttypes.models import ContentType


def migrate_permissions(apps, schema_editor):
    for app_config in apps.get_app_configs():
        app_config.models_module = True
        create_permissions(app_config, apps=apps, verbosity=0)
        app_config.models_module = None


def add_view_task_permissions_for_admins(apps, schema_editor):
    Group = apps.get_model('auth', 'Group')
    Permission = apps.get_model('auth', 'Permission')
    view_task_perm = Permission.objects.get(codename='view_task')
    administrators = Group.objects.get(name='Administrators')
    administrators.permissions.add(view_task_perm)


class Migration(migrations.Migration):
    dependencies = [
        ('website', '0017_auto_20180617_1418'),
    ]

    operations = [
        #migrations.RunPython(migrate_permissions),
        #migrations.RunPython(add_view_task_permissions_for_admins)
    ]
