# Generated by Django 2.2.5 on 2019-09-20 17:08

from django.conf import settings
import django.contrib.auth.models
import django.contrib.auth.validators
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('auth', '0011_update_proxy_permissions'),
    ]

    operations = [
        migrations.CreateModel(
            name='User',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('password', models.CharField(max_length=128, verbose_name='password')),
                ('last_login', models.DateTimeField(blank=True, null=True, verbose_name='last login')),
                ('is_superuser', models.BooleanField(default=False, help_text='Designates that this user has all permissions without explicitly assigning them.', verbose_name='superuser status')),
                ('username', models.CharField(error_messages={'unique': 'A user with that username already exists.'}, help_text='Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only.', max_length=150, unique=True, validators=[django.contrib.auth.validators.UnicodeUsernameValidator()], verbose_name='username')),
                ('first_name', models.CharField(blank=True, max_length=30, verbose_name='first name')),
                ('last_name', models.CharField(blank=True, max_length=150, verbose_name='last name')),
                ('email', models.EmailField(blank=True, max_length=254, verbose_name='email address')),
                ('is_staff', models.BooleanField(default=False, help_text='Designates whether the user can log into this admin site.', verbose_name='staff status')),
                ('is_active', models.BooleanField(default=True, help_text='Designates whether this user should be treated as active. Unselect this instead of deleting accounts.', verbose_name='active')),
                ('date_joined', models.DateTimeField(default=django.utils.timezone.now, verbose_name='date joined')),
                ('title', models.CharField(max_length=50, verbose_name='名称')),
            ],
            options={
                'verbose_name': '用户',
                'verbose_name_plural': '用户',
                'ordering': ['-id'],
            },
            managers=[
                ('objects', django.contrib.auth.models.UserManager()),
            ],
        ),
        migrations.CreateModel(
            name='Domain',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('title', models.CharField(max_length=100, verbose_name='描述')),
                ('sequence', models.IntegerField(default=99999, verbose_name='排序')),
                ('app', models.CharField(max_length=100, verbose_name='应用')),
                ('name', models.CharField(max_length=100, verbose_name='名称')),
            ],
            options={
                'verbose_name': '模型',
                'verbose_name_plural': '模型',
                'ordering': ['sequence', 'id'],
                'unique_together': {('app', 'name')},
            },
        ),
        migrations.CreateModel(
            name='Field',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('title', models.CharField(max_length=200, verbose_name='显示名称')),
                ('sequence', models.IntegerField(verbose_name='序号')),
                ('listable', models.BooleanField(default=True, verbose_name='在列表中显示')),
                ('formable', models.BooleanField(default=True, verbose_name='在表单中显示')),
                ('sortable', models.BooleanField(default=True, verbose_name='可排序')),
                ('exportable', models.BooleanField(default=True, verbose_name='可导出')),
                ('nullable', models.BooleanField(default=False, verbose_name='可以为空')),
                ('unique', models.BooleanField(default=False, verbose_name='是否唯一性')),
                ('default', models.CharField(blank=True, max_length=500, null=True, verbose_name='默认值')),
                ('form_editable', models.BooleanField(default=True, verbose_name='表单可编辑')),
                ('list_editable', models.BooleanField(default=False, verbose_name='列表可编辑')),
                ('searchable', models.BooleanField(default=False, help_text='通过一个关键字搜索选中的每一列', verbose_name='可搜索')),
                ('filterable', models.BooleanField(default=True, help_text='是否可在列表任务栏过滤', verbose_name='可过滤')),
                ('serializable', models.BooleanField(default=True, help_text='RestAPI里是否可以序列化', verbose_name='可序列化')),
                ('help_text', models.TextField(blank=True, null=True, verbose_name='帮助文本')),
                ('attribute', models.CharField(max_length=100, verbose_name='字段名称')),
                ('group_sequence', models.IntegerField(verbose_name='分组序号')),
                ('python_type', models.CharField(max_length=200, verbose_name='原生类型')),
                ('data_type', models.CharField(max_length=10, verbose_name='数据类型')),
                ('max_length', models.IntegerField(default=0, verbose_name='最大长度')),
                ('attribute_domain', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='attribute_domain', to='redmin.Domain', verbose_name='字段模型')),
                ('base', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='base', to='redmin.Domain', verbose_name='父模型')),
            ],
            options={
                'verbose_name': '字段',
                'verbose_name_plural': '字段',
                'ordering': ['base', 'group_sequence', 'sequence'],
            },
        ),
        migrations.CreateModel(
            name='Group',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=50, verbose_name='名称')),
            ],
            options={
                'verbose_name': '用户组',
                'verbose_name_plural': '用户组',
                'ordering': ['-id'],
            },
        ),
        migrations.CreateModel(
            name='Menu',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=100, unique=True, verbose_name='名称')),
                ('sequence', models.IntegerField(default=0, verbose_name='排序')),
            ],
            options={
                'verbose_name': '菜单',
                'verbose_name_plural': '菜单',
                'ordering': ['sequence'],
            },
        ),
        migrations.CreateModel(
            name='SuperPermissionModel',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
            ],
            options={
                'verbose_name': '超級模型',
                'verbose_name_plural': '超級模型',
                'ordering': ['-id'],
            },
        ),
        migrations.CreateModel(
            name='UserFilter',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=100, verbose_name='过滤器名称')),
                ('value_type', models.SmallIntegerField(choices=[(10, '固定值'), (5, '请求属性')], verbose_name='值类型')),
                ('attribute', models.CharField(max_length=100, verbose_name='属性名')),
                ('value', models.CharField(max_length=500, verbose_name='属性值')),
                ('enabled', models.BooleanField(default=True, verbose_name='开通')),
                ('domain', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='redmin.Domain')),
                ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'verbose_name': '过滤器(用户)',
                'verbose_name_plural': '过滤器(用户)',
                'ordering': ['-id'],
            },
        ),
        migrations.CreateModel(
            name='GroupFilter',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=100, verbose_name='过滤器名称')),
                ('value_type', models.SmallIntegerField(choices=[(10, '固定值'), (5, '请求属性')], verbose_name='值类型')),
                ('attribute', models.CharField(max_length=100, verbose_name='属性名')),
                ('value', models.CharField(max_length=500, verbose_name='属性值')),
                ('enabled', models.BooleanField(default=True, verbose_name='开通')),
                ('domain', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='redmin.Domain')),
                ('group', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='redmin.Group')),
            ],
            options={
                'verbose_name': '过滤器(用户组)',
                'verbose_name_plural': '过滤器(用户组)',
                'ordering': ['-id'],
            },
        ),
        migrations.AddField(
            model_name='user',
            name='group',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='redmin.Group'),
        ),
        migrations.AddField(
            model_name='user',
            name='groups',
            field=models.ManyToManyField(blank=True, help_text='The groups this user belongs to. A user will get all permissions granted to each of their groups.', related_name='user_set', related_query_name='user', to='auth.Group', verbose_name='groups'),
        ),
        migrations.AddField(
            model_name='user',
            name='user_permissions',
            field=models.ManyToManyField(blank=True, help_text='Specific permissions for this user.', related_name='user_set', related_query_name='user', to='auth.Permission', verbose_name='user permissions'),
        ),
        migrations.CreateModel(
            name='UserPermission',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('creatable', models.BooleanField(default=False, verbose_name='可创建')),
                ('savable', models.BooleanField(default=False, verbose_name='可保存')),
                ('removable', models.BooleanField(default=False, verbose_name='可删除')),
                ('cloneable', models.BooleanField(default=False, verbose_name='可复制')),
                ('exportable', models.BooleanField(default=False, verbose_name='可导出')),
                ('viewable', models.BooleanField(default=False, verbose_name='可查看')),
                ('listable', models.BooleanField(default=False, verbose_name='可列表')),
                ('selectable', models.BooleanField(default=True, verbose_name='可选择')),
                ('domain', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='redmin.Domain')),
                ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'verbose_name': '权限(用户)',
                'verbose_name_plural': '权限(用户)',
                'ordering': ['-id'],
                'unique_together': {('user', 'domain')},
            },
        ),
        migrations.CreateModel(
            name='UserField',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('title', models.CharField(max_length=200, verbose_name='显示名称')),
                ('sequence', models.IntegerField(verbose_name='序号')),
                ('listable', models.BooleanField(default=True, verbose_name='在列表中显示')),
                ('formable', models.BooleanField(default=True, verbose_name='在表单中显示')),
                ('sortable', models.BooleanField(default=True, verbose_name='可排序')),
                ('exportable', models.BooleanField(default=True, verbose_name='可导出')),
                ('nullable', models.BooleanField(default=False, verbose_name='可以为空')),
                ('unique', models.BooleanField(default=False, verbose_name='是否唯一性')),
                ('default', models.CharField(blank=True, max_length=500, null=True, verbose_name='默认值')),
                ('form_editable', models.BooleanField(default=True, verbose_name='表单可编辑')),
                ('list_editable', models.BooleanField(default=False, verbose_name='列表可编辑')),
                ('searchable', models.BooleanField(default=False, help_text='通过一个关键字搜索选中的每一列', verbose_name='可搜索')),
                ('filterable', models.BooleanField(default=True, help_text='是否可在列表任务栏过滤', verbose_name='可过滤')),
                ('serializable', models.BooleanField(default=True, help_text='RestAPI里是否可以序列化', verbose_name='可序列化')),
                ('help_text', models.TextField(blank=True, null=True, verbose_name='帮助文本')),
                ('field', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='redmin.Field')),
                ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'verbose_name': '字段(用户)',
                'verbose_name_plural': '字段(用户)',
                'ordering': ['user', 'field'],
                'unique_together': {('user', 'field')},
            },
        ),
        migrations.CreateModel(
            name='UserDomain',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('title', models.CharField(max_length=100, verbose_name='描述')),
                ('sequence', models.IntegerField(default=99999, verbose_name='排序')),
                ('app', models.CharField(max_length=100, verbose_name='应用')),
                ('name', models.CharField(max_length=100, verbose_name='名称')),
                ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'verbose_name': '用户模型',
                'verbose_name_plural': '用户模型',
                'ordering': ['user', 'sequence'],
                'unique_together': {('user', 'app', 'name')},
            },
        ),
        migrations.CreateModel(
            name='GroupPermission',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('creatable', models.BooleanField(default=False, verbose_name='可创建')),
                ('savable', models.BooleanField(default=False, verbose_name='可保存')),
                ('removable', models.BooleanField(default=False, verbose_name='可删除')),
                ('cloneable', models.BooleanField(default=False, verbose_name='可复制')),
                ('exportable', models.BooleanField(default=False, verbose_name='可导出')),
                ('viewable', models.BooleanField(default=False, verbose_name='可查看')),
                ('listable', models.BooleanField(default=False, verbose_name='可列表')),
                ('selectable', models.BooleanField(default=True, verbose_name='可选择')),
                ('domain', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='redmin.Domain')),
                ('group', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='redmin.Group')),
            ],
            options={
                'verbose_name': '权限(用户组)',
                'verbose_name_plural': '权限(用户组)',
                'ordering': ['-id'],
                'unique_together': {('group', 'domain')},
            },
        ),
        migrations.CreateModel(
            name='GroupField',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('title', models.CharField(max_length=200, verbose_name='显示名称')),
                ('sequence', models.IntegerField(verbose_name='序号')),
                ('listable', models.BooleanField(default=True, verbose_name='在列表中显示')),
                ('formable', models.BooleanField(default=True, verbose_name='在表单中显示')),
                ('sortable', models.BooleanField(default=True, verbose_name='可排序')),
                ('exportable', models.BooleanField(default=True, verbose_name='可导出')),
                ('nullable', models.BooleanField(default=False, verbose_name='可以为空')),
                ('unique', models.BooleanField(default=False, verbose_name='是否唯一性')),
                ('default', models.CharField(blank=True, max_length=500, null=True, verbose_name='默认值')),
                ('form_editable', models.BooleanField(default=True, verbose_name='表单可编辑')),
                ('list_editable', models.BooleanField(default=False, verbose_name='列表可编辑')),
                ('searchable', models.BooleanField(default=False, help_text='通过一个关键字搜索选中的每一列', verbose_name='可搜索')),
                ('filterable', models.BooleanField(default=True, help_text='是否可在列表任务栏过滤', verbose_name='可过滤')),
                ('serializable', models.BooleanField(default=True, help_text='RestAPI里是否可以序列化', verbose_name='可序列化')),
                ('help_text', models.TextField(blank=True, null=True, verbose_name='帮助文本')),
                ('field', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='redmin.Field', verbose_name='默认字段')),
                ('group', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='redmin.Group')),
            ],
            options={
                'verbose_name': '字段(用户组)',
                'verbose_name_plural': '字段(用户组)',
                'ordering': ['group', 'field'],
                'unique_together': {('group', 'field')},
            },
        ),
        migrations.CreateModel(
            name='GroupDomain',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('title', models.CharField(max_length=100, verbose_name='描述')),
                ('sequence', models.IntegerField(default=99999, verbose_name='排序')),
                ('app', models.CharField(max_length=100, verbose_name='应用')),
                ('name', models.CharField(max_length=100, verbose_name='名称')),
                ('group', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='redmin.Group')),
            ],
            options={
                'verbose_name': '用户组模型',
                'verbose_name_plural': '用户组模型',
                'ordering': ['group', 'sequence'],
                'unique_together': {('group', 'app', 'name')},
            },
        ),
        migrations.CreateModel(
            name='DomainMenu',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('domain', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='redmin.Domain')),
                ('menu', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='redmin.Menu')),
            ],
            options={
                'verbose_name': '模型菜单',
                'verbose_name_plural': '模型菜单',
                'ordering': ['menu__sequence', 'domain__sequence'],
                'unique_together': {('menu', 'domain')},
            },
        ),
        migrations.CreateModel(
            name='Choice',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('title', models.CharField(max_length=100, verbose_name='标题')),
                ('value', models.CharField(max_length=100, verbose_name='值')),
                ('field', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='redmin.Field', verbose_name='默认字段')),
            ],
            options={
                'verbose_name': '选项',
                'verbose_name_plural': '选项',
                'ordering': ['field', 'id'],
                'unique_together': {('field', 'value')},
            },
        ),
    ]
