# Generated by Django 2.2.4 on 2019-11-25 13:51

from django.db import migrations
from django.conf import settings


def apply_migration(apps, schema_editor):
    Group = apps.get_model('auth', 'Group')
    Permission = apps.get_model('auth', 'Permission')
    new_group = Group.objects.create(name='autoenrollment-rent')
    rent_add_perm = Permission.objects.get(name='Can add rent')
    new_group.permissions.add(rent_add_perm)


def revert_migration(apps, schema_editor):
    Group = apps.get_model('auth', 'Group')
    Group.objects.filter(name='autoenrollment-rent').delete()


class Migration(migrations.Migration):

    dependencies = [
        ('cykel', '0001_initial'),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
        ('bikesharing', '0001_initial'),
    ]

    operations = [
        migrations.RunPython(apply_migration, revert_migration)
    ]
