# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-07-13 13:03
from __future__ import unicode_literals

from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import login.models


class Migration(migrations.Migration):

    dependencies = [
        ('dataedit', '0011_tablerevision_size'),
        ('auth', '0008_alter_user_username_max_length'),
        ('login', '0005_auto_20170202_1122'),
    ]

    operations = [
        migrations.CreateModel(
            name='GroupPermission',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('level', models.IntegerField(choices=[(0, 'None'), (4, 'Write'), (8, 'Delete'), (12, 'Admin')], default=0)),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='UserGroup',
            fields=[
                ('group_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='auth.Group')),
            ],
            bases=('auth.group', login.models.PermissionHolder),
        ),
        migrations.CreateModel(
            name='UserPermission',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('level', models.IntegerField(choices=[(0, 'None'), (4, 'Write'), (8, 'Delete'), (12, 'Admin')], default=0)),
                ('holder', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='table_permissions', to=settings.AUTH_USER_MODEL)),
                ('table', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='dataedit.Table')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.AddField(
            model_name='grouppermission',
            name='holder',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='table_permissions', to='login.UserGroup'),
        ),
        migrations.AddField(
            model_name='grouppermission',
            name='table',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='dataedit.Table'),
        ),
        migrations.AlterUniqueTogether(
            name='userpermission',
            unique_together=set([('table', 'holder')]),
        ),
        migrations.AlterUniqueTogether(
            name='grouppermission',
            unique_together=set([('table', 'holder')]),
        ),
    ]
