# -*- coding: utf-8 -*-
# Generated by Django 1.10.6 on 2017-03-17 13:30
from __future__ import unicode_literals

from django.db import migrations


def copy_autogroup(apps, schema_editor):
    existing = apps.get_model('accounts', 'AutoGroup').objects.all()
    AutoGroup = apps.get_model('permissions', 'AutoGroup')

    for item in existing.iterator():
        AutoGroup.objects.create(
            group=item.group,
            match=item.match,
        )


class Migration(migrations.Migration):

    dependencies = [
        ('permissions', '0003_autogroup'),
        ('accounts', '0025_auto_20170211_1609'),
    ]

    operations = [
        migrations.RunPython(copy_autogroup),
    ]
