# Generated by Django 2.1.3 on 2019-06-20 12:30

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


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('auth', '0009_alter_user_last_name_max_length'),
    ]

    operations = [
        migrations.CreateModel(
            name='UserProfile',
            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')),
                ('email', models.EmailField(max_length=255, unique=True, verbose_name='email address')),
                ('name', models.CharField(max_length=1024, verbose_name='姓名')),
                ('is_active', models.BooleanField(default=True)),
                ('is_staff', models.BooleanField(default=True)),
                ('groups', 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')),
            ],
            options={
                'verbose_name_plural': '自定义用户登录表',
            },
        ),
        migrations.CreateModel(
            name='Branch',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=1024, unique=True)),
                ('addr', models.CharField(blank=True, max_length=1024, null=True)),
            ],
            options={
                'verbose_name_plural': '校区表',
            },
        ),
        migrations.CreateModel(
            name='ClassList',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('class_type', models.SmallIntegerField(choices=[(0, '脱产'), (0, '周末'), (0, '网络班')], default=0, verbose_name='班级类型')),
                ('semester', models.SmallIntegerField(verbose_name='学期')),
                ('start_date', models.DateField(verbose_name='开班日期')),
                ('graduate_date', models.DateField(blank=True, null=True, verbose_name='毕业日期')),
                ('branch', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='repository.Branch', verbose_name='所在校区')),
            ],
            options={
                'verbose_name_plural': '班级列表 ',
            },
        ),
        migrations.CreateModel(
            name='ContractTemplate',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=1024)),
                ('content', models.TextField()),
                ('date', models.DateTimeField(auto_now_add=True)),
            ],
            options={
                'verbose_name_plural': '合同模板表',
            },
        ),
        migrations.CreateModel(
            name='Course',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=1024, unique=True, verbose_name='课程名称')),
                ('price', models.PositiveIntegerField(verbose_name='课程价格')),
                ('perid', models.PositiveIntegerField(default=5, verbose_name='课程周期(月)')),
                ('outline', models.TextField(verbose_name='课程大纲')),
            ],
            options={
                'verbose_name_plural': '课程表',
            },
        ),
        migrations.CreateModel(
            name='CourseRecord',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('day_num', models.PositiveSmallIntegerField(verbose_name='课程节次')),
                ('title', models.CharField(max_length=1024, verbose_name='本节主题')),
                ('content', models.TextField(verbose_name='本节内容')),
                ('has_homework', models.BooleanField(default=True, verbose_name='本节是否有作业')),
                ('homework', models.TextField(blank=True, null=True, verbose_name='作业需求法')),
                ('date', models.DateTimeField(auto_now_add=True, verbose_name='上课记录创建时间')),
                ('class_grade', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='repository.ClassList', verbose_name='所属班级')),
                ('teacher', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, verbose_name='讲师')),
            ],
            options={
                'verbose_name_plural': '讲师上课记录表',
            },
        ),
        migrations.CreateModel(
            name='CustomerFollowUp',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('content', models.TextField(verbose_name='跟踪内容')),
                ('status', models.SmallIntegerField(choices=[(0, '近期无报名计划'), (1, '一个月内报名'), (2, '2 周内报名'), (3, '已 报名')], verbose_name='跟踪客户状态')),
                ('date', models.DateField(auto_now_add=True, verbose_name='跟踪 创建时间')),
            ],
            options={
                'verbose_name_plural': '客户跟踪记录表',
            },
        ),
        migrations.CreateModel(
            name='CustomerInfo',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(default=None, max_length=1024, verbose_name='客户姓名')),
                ('contact_type', models.SmallIntegerField(choices=[(0, 'qq '), (1, '微信'), (2, '手机')], default=0, verbose_name='联系来源')),
                ('contact', models.CharField(max_length=1024, unique=True, verbose_name='联系方式')),
                ('source', models.SmallIntegerField(choices=[(0, 'QQ群'), (1, '51CTO'), (2, '百度推广'), (3, '知乎'), (4, '转介绍'), (5, '其他')], verbose_name='客户来源')),
                ('consult_content', models.TextField(verbose_name='咨询内容')),
                ('status', models.SmallIntegerField(choices=[(0, '未报名'), (1, '已报名'), (2, '已退学')], verbose_name='客户状态')),
                ('id_num', models.CharField(blank=True, max_length=1024, null=True, verbose_name='身份证号')),
                ('emergency_contact', models.PositiveSmallIntegerField(blank=True, null=True, verbose_name='紧急联系')),
                ('sex', models.PositiveSmallIntegerField(blank=True, choices=[(0, '男'), (1, '女')], null=True, verbose_name='性别')),
                ('date', models.DateField(auto_now_add=True, verbose_name='建交时间')),
                ('consult_courses', models.ManyToManyField(to='repository.Course', verbose_name='咨询课程')),
                ('consultant', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, verbose_name='课程顾问')),
                ('referral_from', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='repository.CustomerInfo', verbose_name='转介绍')),
            ],
            options={
                'verbose_name_plural': '客户信息表',
            },
        ),
        migrations.CreateModel(
            name='Menus',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=1024, verbose_name='菜单名')),
                ('url_type', models.SmallIntegerField(choices=[(0, 'absolute'), (1, 'dynamic')], default=0, verbose_name='菜单类型')),
                ('url_name', models.CharField(max_length=1024, verbose_name=' 菜单URL')),
            ],
            options={
                'verbose_name_plural': '动态菜单表',
            },
        ),
        migrations.CreateModel(
            name='PaymentRecord',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('payment_type', models.SmallIntegerField(choices=[(0, '报名费'), (1, '学费'), (2, '退费')], verbose_name='缴费类型')),
                ('amount', models.IntegerField(default=500, verbose_name='缴费金额')),
                ('date', models.DateTimeField(auto_now_add=True, verbose_name='缴费日期')),
                ('consultant', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, verbose_name='缴费顾问')),
            ],
            options={
                'verbose_name_plural': '缴费记录表',
            },
        ),
        migrations.CreateModel(
            name='Role',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=1024, unique=True)),
                ('menus', models.ManyToManyField(blank=True, null=True, to='repository.Menus')),
            ],
            options={
                'verbose_name_plural': '角色表',
            },
        ),
        migrations.CreateModel(
            name='Student',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('class_grades', models.ManyToManyField(to='repository.ClassList', verbose_name='所在班级')),
                ('customer', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to='repository.CustomerInfo', verbose_name='详细信息')),
            ],
            options={
                'verbose_name_plural': '学员表',
            },
        ),
        migrations.CreateModel(
            name='StudentEnrollment',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('contract_agreed', models.BooleanField(default=False, verbose_name='合同状态')),
                ('contract_signed_date', models.DateTimeField(blank=True, null=True, verbose_name='合同同意日期')),
                ('contract_approved', models.BooleanField(default=False, verbose_name='审核状态')),
                ('contract_approved_date', models.DateTimeField(blank=True, null=True, verbose_name='合同审核日期')),
                ('class_grade', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='repository.ClassList', verbose_name='报名班级')),
                ('consultant', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, verbose_name='报名顾问')),
                ('customer', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='repository.CustomerInfo', verbose_name='客户名')),
            ],
            options={
                'verbose_name_plural': '学员报名表',
            },
        ),
        migrations.CreateModel(
            name='StudyRecord',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('score', models.SmallIntegerField(choices=[(100, 'A+'), (90, 'A'), (85, 'B+'), (80, 'B'), (75, 'B-'), (70, 'C+'), (60, 'C'), (40, 'C-'), (-50, 'D'), (0, 'N/A'), (-100, 'COPY')], default=0, verbose_name='学生成绩')),
                ('show_status', models.SmallIntegerField(choices=[(0, '缺勤'), (1, '已签到'), (2, '迟到'), (3, '早退')], default=1, verbose_name='学生状态')),
                ('note', models.TextField(verbose_name='成绩备注')),
                ('date', models.DateTimeField(auto_now_add=True)),
                ('course_record', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='repository.CourseRecord', verbose_name='所属课堂')),
                ('student', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='repository.Student', verbose_name='学生姓名')),
            ],
            options={
                'verbose_name_plural': '学员学习记录表',
            },
        ),
        migrations.AddField(
            model_name='paymentrecord',
            name='enrollment',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='repository.StudentEnrollment', verbose_name='所在报名表'),
        ),
        migrations.AlterUniqueTogether(
            name='menus',
            unique_together={('name', 'url_name')},
        ),
        migrations.AddField(
            model_name='customerfollowup',
            name='customer',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='repository.CustomerInfo', verbose_name='客户'),
        ),
        migrations.AddField(
            model_name='customerfollowup',
            name='user',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, verbose_name='跟进人'),
        ),
        migrations.AddField(
            model_name='classlist',
            name='contract_template',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='repository.ContractTemplate', verbose_name='班级合同'),
        ),
        migrations.AddField(
            model_name='classlist',
            name='course',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='repository.Course', verbose_name='班级课程'),
        ),
        migrations.AddField(
            model_name='classlist',
            name='teachers',
            field=models.ManyToManyField(to=settings.AUTH_USER_MODEL, verbose_name='讲师'),
        ),
        migrations.AddField(
            model_name='userprofile',
            name='role',
            field=models.ManyToManyField(blank=True, null=True, to='repository.Role', verbose_name='拥有角色'),
        ),
        migrations.AddField(
            model_name='userprofile',
            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.AlterUniqueTogether(
            name='studentenrollment',
            unique_together={('customer', 'class_grade')},
        ),
        migrations.AlterUniqueTogether(
            name='courserecord',
            unique_together={('class_grade', 'day_num')},
        ),
        migrations.AlterUniqueTogether(
            name='classlist',
            unique_together={('branch', 'class_type', 'course', 'semester')},
        ),
    ]
