예제 #1
0
class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('auth', '0008_alter_user_username_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')),
                ('username', models.EmailField(max_length=255, unique=True)),
                ('is_staff',
                 models.BooleanField(
                     default=False,
                     help_text=
                     'Designates whether the user can log into this admin site.',
                     verbose_name='staff status')),
                ('is_admin', models.BooleanField(default=False)),
                ('name', models.CharField(max_length=32, verbose_name='名字')),
                ('mobile',
                 models.CharField(blank=True,
                                  default=None,
                                  max_length=32,
                                  null=True,
                                  verbose_name='手机')),
                ('memo',
                 models.TextField(blank=True,
                                  default=None,
                                  null=True,
                                  verbose_name='备注')),
                ('date_joined', models.DateTimeField(auto_now_add=True)),
            ],
            options={
                'verbose_name': '账户信息',
                'verbose_name_plural': '账户信息',
            },
            managers=[
                ('objects', crm.models.UserManager()),
            ],
        ),
        migrations.CreateModel(
            name='Campuses',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('name', models.CharField(max_length=64, verbose_name='校区')),
                ('address',
                 models.CharField(blank=True,
                                  max_length=512,
                                  null=True,
                                  verbose_name='详细地址')),
            ],
        ),
        migrations.CreateModel(
            name='ClassList',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('course',
                 models.CharField(choices=[('LinuxL', 'Linux中高级'),
                                           ('PythonFullStack', 'Python高级全栈开发')
                                           ],
                                  max_length=64,
                                  verbose_name='课程名称')),
                ('semester', models.IntegerField(verbose_name='学期')),
                ('price', models.IntegerField(default=10000,
                                              verbose_name='学费')),
                ('memo',
                 models.CharField(blank=True,
                                  max_length=100,
                                  null=True,
                                  verbose_name='说明')),
                ('start_date', models.DateField(verbose_name='开班日期')),
                ('graduate_date',
                 models.DateField(blank=True, null=True, verbose_name='结业日期')),
                ('class_type',
                 models.CharField(blank=True,
                                  choices=[('fulltime', '脱产班'),
                                           ('online', '网络班'),
                                           ('weekend', '周末班')],
                                  max_length=64,
                                  null=True,
                                  verbose_name='班额及类型')),
                ('campuses',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to='crm.Campuses',
                                   verbose_name='校区')),
            ],
        ),
        migrations.CreateModel(
            name='ConsultRecord',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('note', models.TextField(verbose_name='跟进内容...')),
                ('status',
                 models.CharField(choices=[('A', '近期无报名计划'), ('B', '1个月内报名'),
                                           ('C', '2周内报名'), ('D', '1周内报名'),
                                           ('E', '定金'), ('F', '到班'),
                                           ('G', '全款'), ('H', '无效')],
                                  help_text='选择客户此时的状态',
                                  max_length=8,
                                  verbose_name='跟进状态')),
                ('date',
                 models.DateTimeField(auto_now_add=True, verbose_name='跟进日期')),
                ('delete_status',
                 models.BooleanField(default=False, verbose_name='删除状态')),
                ('consultant',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   related_name='records',
                                   to=settings.AUTH_USER_MODEL,
                                   verbose_name='跟进人')),
            ],
        ),
        migrations.CreateModel(
            name='ContractTemplate',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('name',
                 models.CharField(max_length=128,
                                  unique=True,
                                  verbose_name='合同名称')),
                ('content', models.TextField(verbose_name='合同内容')),
                ('date', models.DateField(auto_now=True)),
            ],
        ),
        migrations.CreateModel(
            name='CourseRecord',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('day_num',
                 models.IntegerField(help_text='此处填写第几节课或第几天课程...,必须为数字',
                                     verbose_name='节次')),
                ('date',
                 models.DateField(auto_now_add=True, verbose_name='上课日期')),
                ('course_title',
                 models.CharField(blank=True,
                                  max_length=64,
                                  null=True,
                                  verbose_name='本节课程标题')),
                ('course_memo',
                 models.TextField(blank=True,
                                  max_length=300,
                                  null=True,
                                  verbose_name='本节课程内容')),
                ('has_homework',
                 models.BooleanField(default=True, verbose_name='本节有作业')),
                ('homework_title',
                 models.CharField(blank=True,
                                  max_length=64,
                                  null=True,
                                  verbose_name='本节作业标题')),
                ('homework_memo',
                 models.TextField(blank=True,
                                  max_length=500,
                                  null=True,
                                  verbose_name='作业描述')),
                ('scoring_point',
                 models.TextField(blank=True,
                                  max_length=300,
                                  null=True,
                                  verbose_name='得分点')),
                ('re_class',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to='crm.ClassList',
                                   verbose_name='班级')),
                ('teacher',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to=settings.AUTH_USER_MODEL,
                                   verbose_name='讲师')),
            ],
        ),
        migrations.CreateModel(
            name='Customer',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('qq',
                 models.CharField(help_text='QQ号必须唯一',
                                  max_length=64,
                                  unique=True,
                                  verbose_name='QQ')),
                ('qq_name',
                 models.CharField(blank=True,
                                  max_length=64,
                                  null=True,
                                  verbose_name='QQ昵称')),
                ('name',
                 models.CharField(blank=True,
                                  help_text='学员报名后,请改为真实姓名',
                                  max_length=32,
                                  null=True,
                                  verbose_name='姓名')),
                ('sex',
                 models.CharField(blank=True,
                                  choices=[('male', '男'), ('female', '女')],
                                  default='male',
                                  max_length=16,
                                  null=True,
                                  verbose_name='性别')),
                ('birthday',
                 models.DateField(blank=True,
                                  default=None,
                                  help_text='格式yyyy-mm-dd',
                                  null=True,
                                  verbose_name='出生日期')),
                ('phone',
                 models.BigIntegerField(blank=True,
                                        null=True,
                                        verbose_name='手机号')),
                ('source',
                 models.CharField(choices=[('qq', 'qq群'),
                                           ('referral', '内部转介绍'),
                                           ('website', '官方网站'),
                                           ('baidu_ads', '百度推广'),
                                           ('office_direct', '直接上门'),
                                           ('WoM', '口碑'),
                                           ('public_class', '公开课'),
                                           ('website_luffy', '路飞官网'),
                                           ('others', '其它')],
                                  default='qq',
                                  max_length=64,
                                  verbose_name='客户来源')),
                ('class_type',
                 models.CharField(choices=[('fulltime', '脱产班'),
                                           ('online', '网络班'),
                                           ('weekend', '周末班')],
                                  default='fulltime',
                                  max_length=64,
                                  verbose_name='班级类型')),
                ('customer_note',
                 models.TextField(blank=True, null=True, verbose_name='客户备注')),
                ('status',
                 models.CharField(choices=[('signed', '已报名'),
                                           ('unregistered', '未报名'),
                                           ('studying', '学习中'),
                                           ('paid_in_full', '学费已交齐')],
                                  default='unregistered',
                                  help_text='选择客户此时的状态',
                                  max_length=64,
                                  verbose_name='状态')),
                ('network_consult_note',
                 models.TextField(blank=True,
                                  null=True,
                                  verbose_name='网络咨询师咨询内容')),
                ('date',
                 models.DateTimeField(auto_now_add=True, verbose_name='咨询日期')),
                ('last_consult_date',
                 models.DateField(auto_now_add=True, verbose_name='最后跟进日期')),
                ('next_date',
                 models.DateField(blank=True,
                                  null=True,
                                  verbose_name='预计再次跟进时间')),
                ('class_list',
                 models.ManyToManyField(to='crm.ClassList',
                                        verbose_name='已报班级')),
                ('consultant',
                 models.ForeignKey(blank=True,
                                   null=True,
                                   on_delete=django.db.models.deletion.CASCADE,
                                   related_name='customers',
                                   to=settings.AUTH_USER_MODEL,
                                   verbose_name='销售')),
                ('introduce_from',
                 models.ForeignKey(blank=True,
                                   null=True,
                                   on_delete=django.db.models.deletion.CASCADE,
                                   to='crm.Customer',
                                   verbose_name='转介绍自学员')),
                ('network_consultant',
                 models.ForeignKey(blank=True,
                                   null=True,
                                   on_delete=django.db.models.deletion.CASCADE,
                                   related_name='network_consultant',
                                   to=settings.AUTH_USER_MODEL,
                                   verbose_name='咨询师')),
            ],
        ),
        migrations.CreateModel(
            name='Department',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('name', models.CharField(max_length=32, verbose_name='部门名称')),
                ('count', models.IntegerField(default=0, verbose_name='人数')),
            ],
        ),
        migrations.CreateModel(
            name='Enrollment',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('why_us',
                 models.TextField(blank=True,
                                  default=None,
                                  max_length=1024,
                                  null=True,
                                  verbose_name='为什么报名')),
                ('your_expectation',
                 models.TextField(blank=True,
                                  max_length=1024,
                                  null=True,
                                  verbose_name='学完想达到的具体期望')),
                ('contract_agreed',
                 models.BooleanField(default=False,
                                     verbose_name='我已认真阅读完培训协议并同意全部协议内容')),
                ('contract_approved',
                 models.BooleanField(default=False,
                                     help_text='在审阅完学员的资料无误后勾选此项,合同即生效',
                                     verbose_name='审批通过')),
                ('enrolled_date',
                 models.DateTimeField(auto_now_add=True, verbose_name='报名日期')),
                ('memo',
                 models.TextField(blank=True, null=True, verbose_name='备注')),
                ('delete_status',
                 models.BooleanField(default=False, verbose_name='删除状态')),
                ('customer',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to='crm.Customer',
                                   verbose_name='客户名称')),
                ('enrolment_class',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to='crm.ClassList',
                                   verbose_name='所报班级')),
                ('school',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to='crm.Campuses')),
            ],
        ),
        migrations.CreateModel(
            name='PaymentRecord',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('pay_type',
                 models.CharField(choices=[
                     ('deposit', '订金/报名费'), ('tuition', '学费'),
                     ('transfer', '转班'), ('dropout', '退学'), ('refund', '退款')
                 ],
                                  default='deposit',
                                  max_length=64,
                                  verbose_name='费用类型')),
                ('paid_fee', models.IntegerField(default=0,
                                                 verbose_name='费用数额')),
                ('note',
                 models.TextField(blank=True, null=True, verbose_name='备注')),
                ('date',
                 models.DateTimeField(auto_now_add=True, verbose_name='交款日期')),
                ('course',
                 models.CharField(blank=True,
                                  choices=[('LinuxL', 'Linux中高级'),
                                           ('PythonFullStack', 'Python高级全栈开发')
                                           ],
                                  default='N/A',
                                  max_length=64,
                                  null=True,
                                  verbose_name='课程名')),
                ('class_type',
                 models.CharField(blank=True,
                                  choices=[('fulltime', '脱产班'),
                                           ('online', '网络班'),
                                           ('weekend', '周末班')],
                                  default='N/A',
                                  max_length=64,
                                  null=True,
                                  verbose_name='班级类型')),
                ('delete_status',
                 models.BooleanField(default=False, verbose_name='删除状态')),
                ('status',
                 models.IntegerField(choices=[(1, '未审核'), (2, '已审核')],
                                     default=1,
                                     verbose_name='审核')),
                ('confirm_date',
                 models.DateTimeField(blank=True,
                                      null=True,
                                      verbose_name='确认日期')),
                ('confirm_user',
                 models.ForeignKey(blank=True,
                                   null=True,
                                   on_delete=django.db.models.deletion.CASCADE,
                                   related_name='confirms',
                                   to=settings.AUTH_USER_MODEL,
                                   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='crm.Customer',
                                   verbose_name='客户')),
                ('enrolment_class',
                 models.ForeignKey(blank=True,
                                   null=True,
                                   on_delete=django.db.models.deletion.CASCADE,
                                   to='crm.ClassList',
                                   verbose_name='所报班级')),
            ],
        ),
        migrations.CreateModel(
            name='StudyRecord',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('attendance',
                 models.CharField(choices=[('checked', '已签到'),
                                           ('vacate', '请假'), ('late', '迟到'),
                                           ('absence', '缺勤'),
                                           ('leave_early', '早退')],
                                  default='checked',
                                  max_length=64,
                                  verbose_name='考勤')),
                ('score',
                 models.IntegerField(choices=[(100, 'A+'),
                                              (90, 'A'), (85, 'B+'), (80, 'B'),
                                              (70, 'B-'), (60, 'C+'),
                                              (50, 'C'), (40, 'C-'), (0, ' D'),
                                              (-1, 'N/A'), (-100, 'COPY'),
                                              (-1000, 'FAIL')],
                                     default=-1,
                                     verbose_name='本节成绩')),
                ('homework_note',
                 models.CharField(blank=True,
                                  max_length=255,
                                  null=True,
                                  verbose_name='作业批语')),
                ('date', models.DateTimeField(auto_now_add=True)),
                ('note',
                 models.CharField(blank=True,
                                  max_length=255,
                                  null=True,
                                  verbose_name='备注')),
                ('homework',
                 models.FileField(blank=True,
                                  default=None,
                                  null=True,
                                  upload_to='',
                                  verbose_name='作业文件')),
                ('course_record',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to='crm.CourseRecord',
                                   verbose_name='某节课程')),
                ('student',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to='crm.Customer',
                                   verbose_name='学员')),
            ],
        ),
        migrations.AddField(
            model_name='consultrecord',
            name='customer',
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.CASCADE,
                to='crm.Customer',
                verbose_name='所咨询客户'),
        ),
        migrations.AddField(
            model_name='classlist',
            name='contract',
            field=models.ForeignKey(
                blank=True,
                null=True,
                on_delete=django.db.models.deletion.CASCADE,
                to='crm.ContractTemplate',
                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='department',
            field=models.ForeignKey(
                blank=True,
                default=None,
                null=True,
                on_delete=django.db.models.deletion.CASCADE,
                to='crm.Department'),
        ),
        migrations.AddField(
            model_name='userprofile',
            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='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='studyrecord',
            unique_together=set([('course_record', 'student')]),
        ),
        migrations.AlterUniqueTogether(
            name='enrollment',
            unique_together=set([('enrolment_class', 'customer')]),
        ),
        migrations.AlterUniqueTogether(
            name='courserecord',
            unique_together=set([('re_class', 'day_num')]),
        ),
        migrations.AlterUniqueTogether(
            name='classlist',
            unique_together=set([('course', 'semester', 'campuses')]),
        ),
    ]
예제 #2
0
class Migration(migrations.Migration):

    initial = True

    dependencies = [
    ]

    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')),
                ('email', models.EmailField(max_length=255, unique=True, verbose_name='邮箱')),
                ('name', models.CharField(max_length=64, verbose_name='用户名')),
                ('is_active', models.BooleanField(default=True, verbose_name='是否活跃')),
                ('is_admin', models.BooleanField(default=False, verbose_name='是否是管理员')),
            ],
            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=128, unique=True, verbose_name='校区名')),
                ('addr', models.CharField(max_length=256, verbose_name='校区地址')),
            ],
            options={
                'verbose_name_plural': '校区表',
            },
        ),
        migrations.CreateModel(
            name='ClassList',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('semester', models.PositiveSmallIntegerField(verbose_name='学期')),
                ('class_type', models.SmallIntegerField(choices=[(0, '面授(脱产)'), (1, '面授(周末)'), (2, '网络班')], verbose_name='班级类型')),
                ('start_date', models.DateField(verbose_name='开班日期')),
                ('end_data', models.DateField(blank=True, null=True, verbose_name='结业日期')),
                ('branch', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='crm.Branch', verbose_name='校区')),
            ],
            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=64, unique=True, verbose_name='课程名')),
                ('price', models.PositiveIntegerField(verbose_name='课程价格')),
                ('period', models.PositiveIntegerField(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='第几节(天)')),
                ('has_homework', models.BooleanField(default=True, verbose_name='是否有作业')),
                ('homework_title', models.CharField(blank=True, max_length=256, null=True, verbose_name='作业题目')),
                ('homework_content', models.TextField(blank=True, null=True, verbose_name='作业内容')),
                ('outline', models.TextField(verbose_name='本节课程大纲')),
                ('date', models.DateField(auto_now_add=True, verbose_name='上课日期')),
                ('from_class', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='crm.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='Customer',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(blank=True, max_length=64, null=True, verbose_name='客户名')),
                ('qq', models.CharField(max_length=64, unique=True, validators=[django.core.validators.RegexValidator('^\\d+$', 'qq只能为数字', 'invalid')], verbose_name='QQ')),
                ('qq_name', models.CharField(blank=True, max_length=64, null=True, verbose_name='QQ名')),
                ('phone', models.CharField(blank=True, max_length=64, null=True, validators=[crm.models.phone_check], verbose_name='电话')),
                ('source', models.SmallIntegerField(choices=[(0, '转介绍'), (1, 'QQ群'), (2, '官网'), (3, '百度推广'), (4, '51CTO'), (5, '知乎'), (6, '市场推广'), (7, '其他')], verbose_name='客户来源')),
                ('referral_from', models.CharField(blank=True, max_length=64, null=True, verbose_name='转介绍人QQ')),
                ('content', models.TextField(verbose_name='咨询详情')),
                ('date', models.DateTimeField(auto_now_add=True, verbose_name='咨询日期')),
                ('memo', models.TextField(blank=True, null=True, verbose_name='备注')),
                ('status', models.SmallIntegerField(choices=[(0, '已报名'), (1, '未报名')], default=1, verbose_name='是否报名')),
                ('consult_course', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='crm.Course', verbose_name='咨询课程')),
                ('consultant', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, verbose_name='咨询顾问')),
            ],
            options={
                'verbose_name': '客户信息表',
                '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='跟进内容')),
                ('date', models.DateTimeField(auto_now_add=True, verbose_name='咨询日期')),
                ('intention', models.SmallIntegerField(choices=[(0, '两周内报名'), (1, '一个月内报名'), (2, '近期无报名计划'), (3, '无意向'), (4, '已报名'), (5, '已拉黑')], 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='crm.Customer', verbose_name='客户名')),
            ],
            options={
                'verbose_name_plural': '客户跟进表',
            },
        ),
        migrations.CreateModel(
            name='Enrollment',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('contract_agreed', models.BooleanField(default=False, verbose_name='学员已同意合同')),
                ('contract_approved', models.BooleanField(default=False, 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='课程顾问')),
                ('customer', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='crm.Customer', verbose_name='学员')),
                ('enrolled_class', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='crm.ClassList', verbose_name='所报班级')),
            ],
            options={
                'verbose_name_plural': '学员报名表',
            },
        ),
        migrations.CreateModel(
            name='Menu',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=32, verbose_name='菜单名')),
                ('url_name', models.CharField(max_length=64, unique=True, verbose_name='URL别名')),
                ('url_type', models.SmallIntegerField(choices=[(0, 'alias'), (1, 'absolute')], verbose_name='url类型')),
                ('absolute_url', models.CharField(blank=True, max_length=126, verbose_name='url绝对路径')),
            ],
            options={
                'verbose_name_plural': '菜单表',
            },
        ),
        migrations.CreateModel(
            name='Payment',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('amount', models.PositiveIntegerField(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='课程顾问')),
                ('course', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='crm.Course', verbose_name='所报课程')),
                ('customer', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='crm.Customer', 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=64, unique=True, verbose_name='角色类型')),
                ('menus', models.ManyToManyField(to='crm.Menu', 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')),
                ('attendance', models.SmallIntegerField(choices=[(0, '已签到'), (1, '迟到'), (2, '缺勤'), (3, '早退')], verbose_name='考勤')),
                ('score', models.SmallIntegerField(choices=[(100, 'A+'), (90, 'A'), (85, 'B+'), (80, 'B'), (75, 'B-'), (70, 'C+'), (60, 'C'), (40, 'C-'), (40, 'C-'), (-50, 'D'), (-100, 'COPY'), (0, 'N/A')], verbose_name='成绩')),
                ('memo', models.TextField(blank=True, null=True, verbose_name='备注')),
                ('date', models.DateField(auto_now_add=True, verbose_name='日期')),
                ('course_record', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='crm.CourseRecord', verbose_name='课程')),
                ('student', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='crm.Enrollment', verbose_name='学员')),
            ],
            options={
                'verbose_name_plural': '学员上课记录表',
            },
        ),
        migrations.CreateModel(
            name='Tag',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=64, unique=True, verbose_name='标签名')),
            ],
            options={
                'verbose_name_plural': '标签表',
            },
        ),
        migrations.AddField(
            model_name='customer',
            name='tags',
            field=models.ManyToManyField(to='crm.Tag', verbose_name='标签'),
        ),
        migrations.AddField(
            model_name='classlist',
            name='course',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='crm.Course', verbose_name='课程'),
        ),
        migrations.AddField(
            model_name='classlist',
            name='teachers',
            field=models.ManyToManyField(to=settings.AUTH_USER_MODEL, verbose_name='老师'),
        ),
        migrations.AlterUniqueTogether(
            name='studyrecord',
            unique_together=set([('student', 'course_record')]),
        ),
        migrations.AlterUniqueTogether(
            name='enrollment',
            unique_together=set([('customer', 'enrolled_class')]),
        ),
        migrations.AlterUniqueTogether(
            name='courserecord',
            unique_together=set([('from_class', 'day_num')]),
        ),
        migrations.AlterUniqueTogether(
            name='classlist',
            unique_together=set([('branch', 'course', 'semester')]),
        ),
    ]
예제 #3
0
class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('auth', '0008_alter_user_username_max_length'),
    ]

    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')),
                ('email', models.EmailField(max_length=254, unique=True)),
                ('first_name',
                 models.CharField(blank=True, max_length=30, null=True)),
                ('last_name',
                 models.CharField(blank=True, max_length=30, null=True)),
                ('date_joined', models.DateTimeField(auto_now_add=True)),
                ('is_active', models.BooleanField(default=True)),
                ('is_staff', models.BooleanField(default=True)),
                ('updated_by',
                 models.CharField(blank=True, max_length=50, null=True)),
                ('logo',
                 models.ImageField(blank=True, null=True, upload_to='logos/')),
                ('queue1',
                 models.CharField(blank=True, max_length=25, null=True)),
                ('queue2',
                 models.CharField(blank=True, max_length=25, null=True)),
                ('queue3',
                 models.CharField(blank=True, max_length=25, null=True)),
                ('queue4',
                 models.CharField(blank=True, max_length=25, null=True)),
                ('queue5',
                 models.CharField(blank=True, max_length=25, null=True)),
            ],
            options={
                'abstract': False,
            },
            managers=[
                ('objects', crm.models.UserManager()),
            ],
        ),
        migrations.CreateModel(
            name='Affiliate',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('name', models.CharField(max_length=50)),
            ],
        ),
        migrations.CreateModel(
            name='Communication',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated', models.DateTimeField(auto_now=True)),
                ('updated_by',
                 models.CharField(blank=True, max_length=50, null=True)),
                ('email_itin',
                 models.EmailField(blank=True, max_length=254, null=True)),
                ('email_sched',
                 models.EmailField(blank=True, max_length=254, null=True)),
                ('email_marketting',
                 models.EmailField(blank=True, max_length=254, null=True)),
                ('email_accounting',
                 models.EmailField(blank=True, max_length=254, null=True)),
                ('email_invoice',
                 models.EmailField(blank=True, max_length=254, null=True)),
                ('phone_cell', models.CharField(max_length=25)),
                ('phone_home',
                 models.CharField(blank=True, max_length=25, null=True)),
                ('phone_office',
                 models.CharField(blank=True, max_length=25, null=True)),
                ('fax_1', models.CharField(blank=True,
                                           max_length=25,
                                           null=True)),
                ('fax_2', models.CharField(blank=True,
                                           max_length=25,
                                           null=True)),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='Contract',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated', models.DateTimeField(auto_now=True)),
                ('updated_by',
                 models.CharField(blank=True, max_length=50, null=True)),
                ('name', models.CharField(max_length=50)),
                ('owrt',
                 models.CharField(choices=[('OW', 'One way'),
                                           ('RT', 'Round trip'),
                                           ('AN', 'Any')],
                                  max_length=2)),
                ('from_base_amt',
                 models.FloatField(blank=True, default=0, null=True)),
                ('from_total_amt',
                 models.FloatField(blank=True, default=0, null=True)),
                ('from_com_amt',
                 models.FloatField(blank=True, default=0, null=True)),
                ('to_base_amt',
                 models.FloatField(blank=True, default=50000, null=True)),
                ('to_total_amt',
                 models.FloatField(blank=True, default=50000, null=True)),
                ('to_com_amt',
                 models.FloatField(blank=True, default=50000, null=True)),
                ('class_svc',
                 models.CharField(blank=True, max_length=10, null=True)),
                ('origin',
                 models.CharField(blank=True,
                                  default='ANY',
                                  max_length=100,
                                  null=True)),
                ('destination',
                 models.CharField(blank=True,
                                  default='ANY',
                                  max_length=100,
                                  null=True)),
                ('x_origin',
                 models.CharField(blank=True, max_length=100, null=True)),
                ('x_destination',
                 models.CharField(blank=True, max_length=100, null=True)),
                ('fare_basis',
                 models.CharField(blank=True,
                                  default='ANY',
                                  max_length=50,
                                  null=True)),
                ('tour_code',
                 models.CharField(blank=True,
                                  default='ANY',
                                  max_length=50,
                                  null=True)),
                ('tkt_designator',
                 models.CharField(blank=True,
                                  default='ANY',
                                  max_length=50,
                                  null=True)),
                ('flight_no',
                 models.CharField(blank=True,
                                  default='ANY',
                                  max_length=150,
                                  null=True)),
                ('inbound_flight',
                 models.CharField(blank=True,
                                  default='ANY',
                                  max_length=150,
                                  null=True)),
                ('outbound_flight',
                 models.CharField(blank=True,
                                  default='ANY',
                                  max_length=150,
                                  null=True)),
                ('issued_from',
                 models.DateField(blank=True, default='0001-01-01',
                                  null=True)),
                ('issued_until',
                 models.DateField(blank=True, default='0001-01-01',
                                  null=True)),
                ('dep_from',
                 models.DateField(blank=True, default='0001-01-01',
                                  null=True)),
                ('dep_until',
                 models.DateField(blank=True, default='0001-01-01',
                                  null=True)),
                ('ret_from',
                 models.DateField(blank=True, default='0001-01-01',
                                  null=True)),
                ('ret_until',
                 models.DateField(blank=True, default='0001-01-01',
                                  null=True)),
                ('issued_from_blackout',
                 models.DateField(blank=True, default='0001-01-01',
                                  null=True)),
                ('issued_until_blackout',
                 models.DateField(blank=True, default='0001-01-01',
                                  null=True)),
                ('dep_from_blackout',
                 models.DateField(blank=True, default='0001-01-01',
                                  null=True)),
                ('dep_until_blackout',
                 models.DateField(blank=True, default='0001-01-01',
                                  null=True)),
                ('ret_from_blackout',
                 models.DateField(blank=True, default='0001-01-01',
                                  null=True)),
                ('ret_until_blackout',
                 models.DateField(blank=True, default='0001-01-01',
                                  null=True)),
                ('arc_no',
                 models.CharField(blank=True,
                                  default='ANY',
                                  max_length=50,
                                  null=True)),
                ('via_points',
                 models.CharField(blank=True,
                                  default='ANY',
                                  max_length=100,
                                  null=True)),
                ('x_via_points',
                 models.CharField(blank=True, max_length=100, null=True)),
                ('seasonality',
                 models.CharField(blank=True, max_length=100, null=True)),
                ('trip_type',
                 models.CharField(blank=True, max_length=25, null=True)),
                ('description',
                 models.CharField(blank=True, max_length=600, null=True)),
                ('statut', models.BooleanField(default=True)),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='Customer',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated', models.DateTimeField(auto_now=True)),
                ('updated_by',
                 models.CharField(blank=True, max_length=50, null=True)),
                ('agency_id', models.CharField(max_length=100)),
                ('interface_id', models.CharField(max_length=100)),
                ('name', models.CharField(max_length=100)),
                ('address1',
                 models.CharField(blank=True, max_length=100, null=True)),
                ('address2',
                 models.CharField(blank=True, max_length=100, null=True)),
                ('city', models.CharField(blank=True, max_length=50,
                                          null=True)),
                ('state', models.CharField(blank=True,
                                           max_length=25,
                                           null=True)),
                ('country',
                 models.CharField(blank=True, max_length=50, null=True)),
                ('zip_code',
                 models.CharField(blank=True, max_length=20, null=True)),
                ('customer_type',
                 models.CharField(choices=[('A', 'Agency'), ('C', 'Corporate'),
                                           ('L', 'Leisure'), ('V', 'Vendor'),
                                           ('U', 'User')],
                                  max_length=5)),
                ('email',
                 models.EmailField(blank=True, max_length=254, null=True)),
                ('phone', models.CharField(blank=True,
                                           max_length=25,
                                           null=True)),
                ('fax', models.CharField(blank=True, max_length=25,
                                         null=True)),
                ('logo',
                 models.ImageField(blank=True, null=True, upload_to='logos/')),
                ('group',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   related_name='group',
                                   to='crm.Affiliate')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='Dropnet',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated', models.DateTimeField(auto_now=True)),
                ('updated_by',
                 models.CharField(blank=True, max_length=50, null=True)),
                ('pax_type',
                 models.CharField(blank=True, max_length=15, null=True)),
                ('airline',
                 models.CharField(blank=True, max_length=5, null=True)),
                ('dropnet_value',
                 models.CharField(blank=True,
                                  default='0',
                                  max_length=5,
                                  null=True)),
                ('contract',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   related_name='dropnet_contract',
                                   to='crm.Contract')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='ExceptionAirline',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated', models.DateTimeField(auto_now=True)),
                ('updated_by',
                 models.CharField(blank=True, max_length=50, null=True)),
                ('net_value',
                 models.CharField(blank=True,
                                  default='0',
                                  max_length=5,
                                  null=True)),
                ('pub_value',
                 models.CharField(blank=True,
                                  default='0',
                                  max_length=5,
                                  null=True)),
                ('com_value',
                 models.CharField(blank=True,
                                  default='0',
                                  max_length=5,
                                  null=True)),
                ('airline',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to='crm.Customer')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='Markup',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated', models.DateTimeField(auto_now=True)),
                ('updated_by',
                 models.CharField(blank=True, max_length=50, null=True)),
                ('net',
                 models.CharField(blank=True,
                                  default='0',
                                  max_length=5,
                                  null=True)),
                ('pub',
                 models.CharField(blank=True,
                                  default='0',
                                  max_length=5,
                                  null=True)),
                ('com',
                 models.CharField(blank=True,
                                  default='0',
                                  max_length=5,
                                  null=True)),
                ('contract',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   related_name='markup_contract',
                                   to='crm.Contract')),
                ('customer',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   related_name='agency_markup',
                                   to='crm.Customer')),
                ('x_airlines',
                 models.ManyToManyField(related_name='contracts',
                                        through='crm.ExceptionAirline',
                                        to='crm.Customer')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='Pcc',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated', models.DateTimeField(auto_now=True)),
                ('updated_by',
                 models.CharField(blank=True, max_length=50, null=True)),
                ('pcc_value',
                 models.CharField(blank=True, max_length=50, null=True)),
                ('gds', models.CharField(blank=True, max_length=50,
                                         null=True)),
                ('customer',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   related_name='customer_pcc',
                                   to='crm.Customer')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='Reward',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated', models.DateTimeField(auto_now=True)),
                ('updated_by',
                 models.CharField(blank=True, max_length=50, null=True)),
                ('pax_type',
                 models.CharField(blank=True, max_length=15, null=True)),
                ('airline',
                 models.CharField(blank=True, max_length=5, null=True)),
                ('reward_value',
                 models.CharField(blank=True,
                                  default='0',
                                  max_length=5,
                                  null=True)),
                ('contract',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   related_name='reward_contract',
                                   to='crm.Contract')),
                ('customer',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   related_name='agency_reward',
                                   to='crm.Customer')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='Role',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated', models.DateTimeField(auto_now=True)),
                ('updated_by',
                 models.CharField(blank=True, max_length=50, null=True)),
                ('name', models.CharField(max_length=50)),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='Sign',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated', models.DateTimeField(auto_now=True)),
                ('updated_by',
                 models.CharField(blank=True, max_length=50, null=True)),
                ('gds', models.CharField(blank=True, max_length=30,
                                         null=True)),
                ('value', models.CharField(blank=True,
                                           max_length=30,
                                           null=True)),
                ('user',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   related_name='user_id',
                                   to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='Traveler',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated', models.DateTimeField(auto_now=True)),
                ('updated_by',
                 models.CharField(blank=True, max_length=50, null=True)),
                ('relationship',
                 models.CharField(blank=True, max_length=25, null=True)),
                ('title', models.CharField(blank=True,
                                           max_length=10,
                                           null=True)),
                ('first_name',
                 models.CharField(blank=True, max_length=30, null=True)),
                ('middle_name',
                 models.CharField(blank=True, max_length=30, null=True)),
                ('last_name',
                 models.CharField(blank=True, max_length=30, null=True)),
                ('gender', models.CharField(blank=True,
                                            max_length=6,
                                            null=True)),
                ('citizenship',
                 models.CharField(blank=True, max_length=30, null=True)),
                ('passport_no',
                 models.CharField(blank=True, max_length=30, null=True)),
                ('notes', models.TextField(blank=True, null=True)),
                ('birthdate', models.DateField(blank=True, null=True)),
                ('traveler_of',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to='crm.Customer')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.AddField(
            model_name='exceptionairline',
            name='markup',
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.CASCADE, to='crm.Markup'),
        ),
        migrations.AddField(
            model_name='communication',
            name='agency',
            field=models.OneToOneField(
                on_delete=django.db.models.deletion.CASCADE,
                related_name='agency',
                to='crm.Customer'),
        ),
        migrations.AddField(
            model_name='user',
            name='customer',
            field=models.ForeignKey(
                blank=True,
                null=True,
                on_delete=django.db.models.deletion.CASCADE,
                related_name='customer',
                to='crm.Customer'),
        ),
        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='role',
            field=models.ForeignKey(
                blank=True,
                null=True,
                on_delete=django.db.models.deletion.CASCADE,
                related_name='role',
                to='crm.Role'),
        ),
        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'),
        ),
    ]
예제 #4
0
class Migration(migrations.Migration):

    initial = True

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

    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')),
            ],
            options={
                'verbose_name': 'user',
                'verbose_name_plural': 'users',
                'abstract': False,
            },
            bases=(django_multitenant.mixins.TenantModelMixin, models.Model),
            managers=[
                ('objects', crm.models.CustomUserManager()),
            ],
        ),
        migrations.CreateModel(
            name='Attendance',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
            ],
            bases=(django_multitenant.mixins.TenantModelMixin, models.Model),
        ),
        migrations.CreateModel(
            name='Client',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('name', models.CharField(max_length=100, verbose_name='Имя')),
                ('address',
                 models.CharField(blank=True,
                                  max_length=255,
                                  verbose_name='Адрес')),
                ('birthday',
                 models.DateField(blank=True,
                                  null=True,
                                  verbose_name='Дата рождения')),
                ('phone_number',
                 models.CharField(blank=True,
                                  max_length=50,
                                  verbose_name='Телефон')),
                ('email_address',
                 models.CharField(blank=True,
                                  max_length=50,
                                  verbose_name='Email')),
                ('vk_user_id',
                 models.IntegerField(blank=True,
                                     null=True,
                                     verbose_name='id ученика в ВК')),
                ('balance', models.FloatField(default=0,
                                              verbose_name='Баланс')),
            ],
            bases=(django_multitenant.mixins.TenantModelMixin, models.Model),
        ),
        migrations.CreateModel(
            name='ClientSubscriptions',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('purchase_date',
                 models.DateTimeField(default=django.utils.timezone.now,
                                      verbose_name='Дата покупки')),
                ('start_date',
                 models.DateTimeField(default=django.utils.timezone.now,
                                      verbose_name='Дата начала')),
                ('end_date', models.DateTimeField(null=True)),
                ('price', models.FloatField(verbose_name='Стоимость')),
                ('visits_left',
                 models.PositiveIntegerField(
                     verbose_name='Остаток посещений')),
                ('client',
                 django_multitenant.fields.TenantForeignKey(
                     on_delete=django.db.models.deletion.PROTECT,
                     to='crm.Client',
                     verbose_name='Ученик')),
            ],
            options={
                'ordering': ['purchase_date'],
            },
            bases=(django_multitenant.mixins.TenantModelMixin, models.Model),
        ),
        migrations.CreateModel(
            name='Coach',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
            ],
            options={
                'abstract': False,
            },
            bases=(django_multitenant.mixins.TenantModelMixin, models.Model),
        ),
        migrations.CreateModel(
            name='Company',
            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='Название')),
                ('display_name',
                 models.CharField(max_length=100,
                                  verbose_name='Отображаемое название')),
            ],
        ),
        migrations.CreateModel(
            name='DayOfTheWeekClass',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('day',
                 models.PositiveSmallIntegerField(validators=[
                     django.core.validators.MinValueValidator(0),
                     django.core.validators.MaxValueValidator(6)
                 ],
                                                  verbose_name='День недели')),
                ('start_time',
                 models.TimeField(default=django.utils.timezone.now,
                                  verbose_name='Время начала тренировки')),
                ('end_time',
                 models.TimeField(default=django.utils.timezone.now,
                                  verbose_name='Время окнчания тренировки')),
                ('company',
                 models.ForeignKey(
                     default=django_multitenant.utils.get_current_tenant,
                     on_delete=django.db.models.deletion.PROTECT,
                     to='crm.Company')),
            ],
            bases=(django_multitenant.mixins.TenantModelMixin, models.Model),
        ),
        migrations.CreateModel(
            name='Event',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('date', models.DateField(verbose_name='Дата')),
                ('company',
                 models.ForeignKey(
                     default=django_multitenant.utils.get_current_tenant,
                     on_delete=django.db.models.deletion.PROTECT,
                     to='crm.Company')),
            ],
            bases=(django_multitenant.mixins.TenantModelMixin, models.Model),
        ),
        migrations.CreateModel(
            name='EventClass',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('name',
                 models.CharField(max_length=100, verbose_name='Название')),
                ('date_from',
                 models.DateField(blank=True, null=True,
                                  verbose_name='Дата с')),
                ('date_to',
                 models.DateField(blank=True,
                                  null=True,
                                  verbose_name='Дата по')),
                ('coach',
                 django_multitenant.fields.TenantForeignKey(
                     on_delete=django.db.models.deletion.PROTECT,
                     to='crm.Coach',
                     verbose_name='Тренер')),
                ('company',
                 models.ForeignKey(
                     default=django_multitenant.utils.get_current_tenant,
                     on_delete=django.db.models.deletion.PROTECT,
                     to='crm.Company')),
            ],
            options={
                'abstract': False,
            },
            bases=(django_multitenant.mixins.TenantModelMixin, models.Model),
        ),
        migrations.CreateModel(
            name='ExtensionHistory',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('date_extended',
                 models.DateTimeField(default=django.utils.timezone.now,
                                      verbose_name='Дата продления')),
                ('reason',
                 models.CharField(max_length=255,
                                  verbose_name='Причина продления')),
                ('added_visits',
                 models.PositiveIntegerField(
                     verbose_name='Добавлено посещений')),
                ('client_subscription',
                 django_multitenant.fields.TenantForeignKey(
                     on_delete=django.db.models.deletion.PROTECT,
                     to='crm.ClientSubscriptions',
                     verbose_name='Абонемент клиента')),
                ('company',
                 models.ForeignKey(
                     default=django_multitenant.utils.get_current_tenant,
                     on_delete=django.db.models.deletion.PROTECT,
                     to='crm.Company')),
            ],
            options={
                'ordering': ['date_extended'],
            },
            bases=(django_multitenant.mixins.TenantModelMixin, models.Model),
        ),
        migrations.CreateModel(
            name='Location',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('name',
                 models.CharField(max_length=100, verbose_name='Название')),
                ('address',
                 models.CharField(blank=True,
                                  max_length=1000,
                                  verbose_name='Адрес')),
                ('company',
                 models.ForeignKey(
                     default=django_multitenant.utils.get_current_tenant,
                     on_delete=django.db.models.deletion.PROTECT,
                     to='crm.Company')),
            ],
            options={
                'abstract': False,
            },
            bases=(django_multitenant.mixins.TenantModelMixin, models.Model),
        ),
        migrations.CreateModel(
            name='Manager',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('company',
                 models.ForeignKey(
                     default=django_multitenant.utils.get_current_tenant,
                     on_delete=django.db.models.deletion.PROTECT,
                     to='crm.Company')),
                ('user',
                 models.OneToOneField(
                     on_delete=django.db.models.deletion.PROTECT,
                     to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'abstract': False,
            },
            bases=(django_multitenant.mixins.TenantModelMixin, models.Model),
        ),
        migrations.CreateModel(
            name='SubscriptionsType',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('name',
                 models.CharField(max_length=100, verbose_name='Название')),
                ('price', models.FloatField(verbose_name='Стоимость')),
                ('duration_type',
                 models.CharField(choices=[('day', 'День'), ('week', 'Неделя'),
                                           ('month', 'Месяц'),
                                           ('year', 'Год')],
                                  default=('day', 'День'),
                                  max_length=20,
                                  verbose_name='Временные рамки абонемента')),
                ('duration',
                 models.PositiveIntegerField(
                     verbose_name='Продолжительность')),
                ('rounding',
                 models.BooleanField(
                     default=False,
                     verbose_name='Округление начала действия абонемента')),
                ('visit_limit',
                 models.PositiveIntegerField(
                     verbose_name='Количество посещений')),
                ('company',
                 models.ForeignKey(
                     default=django_multitenant.utils.get_current_tenant,
                     on_delete=django.db.models.deletion.PROTECT,
                     to='crm.Company')),
                ('event_class',
                 models.ManyToManyField(to='crm.EventClass',
                                        verbose_name='Допустимые тренировки')),
            ],
            options={
                'abstract': False,
            },
            bases=(django_multitenant.mixins.TenantModelMixin, models.Model),
        ),
        migrations.AddField(
            model_name='eventclass',
            name='location',
            field=django_multitenant.fields.TenantForeignKey(
                on_delete=django.db.models.deletion.PROTECT,
                to='crm.Location',
                verbose_name='Расположение'),
        ),
        migrations.AddField(
            model_name='event',
            name='event_class',
            field=django_multitenant.fields.TenantForeignKey(
                on_delete=django.db.models.deletion.PROTECT,
                to='crm.EventClass',
                verbose_name='Тренировка'),
        ),
        migrations.AddField(
            model_name='dayoftheweekclass',
            name='event',
            field=django_multitenant.fields.TenantForeignKey(
                on_delete=django.db.models.deletion.CASCADE,
                to='crm.EventClass',
                verbose_name='Мероприятие'),
        ),
        migrations.AddField(
            model_name='coach',
            name='company',
            field=models.ForeignKey(
                default=django_multitenant.utils.get_current_tenant,
                on_delete=django.db.models.deletion.PROTECT,
                to='crm.Company'),
        ),
        migrations.AddField(
            model_name='coach',
            name='user',
            field=models.OneToOneField(
                on_delete=django.db.models.deletion.PROTECT,
                to=settings.AUTH_USER_MODEL),
        ),
        migrations.AddField(
            model_name='clientsubscriptions',
            name='company',
            field=models.ForeignKey(
                default=django_multitenant.utils.get_current_tenant,
                on_delete=django.db.models.deletion.PROTECT,
                to='crm.Company'),
        ),
        migrations.AddField(
            model_name='clientsubscriptions',
            name='subscription',
            field=django_multitenant.fields.TenantForeignKey(
                on_delete=django.db.models.deletion.PROTECT,
                to='crm.SubscriptionsType',
                verbose_name='Тип Абонемента'),
        ),
        migrations.AddField(
            model_name='client',
            name='company',
            field=models.ForeignKey(
                default=django_multitenant.utils.get_current_tenant,
                on_delete=django.db.models.deletion.PROTECT,
                to='crm.Company'),
        ),
        migrations.AddField(
            model_name='attendance',
            name='client',
            field=django_multitenant.fields.TenantForeignKey(
                on_delete=django.db.models.deletion.PROTECT,
                to='crm.Client',
                verbose_name='Ученик'),
        ),
        migrations.AddField(
            model_name='attendance',
            name='company',
            field=models.ForeignKey(
                default=django_multitenant.utils.get_current_tenant,
                on_delete=django.db.models.deletion.PROTECT,
                to='crm.Company'),
        ),
        migrations.AddField(
            model_name='attendance',
            name='event',
            field=django_multitenant.fields.TenantForeignKey(
                on_delete=django.db.models.deletion.PROTECT,
                to='crm.Event',
                verbose_name='Тренировка'),
        ),
        migrations.AddField(
            model_name='user',
            name='company',
            field=models.ForeignKey(
                default=crm.models.get_user_current_tenant,
                on_delete=django.db.models.deletion.PROTECT,
                to='crm.Company'),
        ),
        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.AlterUniqueTogether(
            name='subscriptionstype',
            unique_together={('id', 'company')},
        ),
        migrations.AlterUniqueTogether(
            name='manager',
            unique_together={('id', 'company')},
        ),
        migrations.AlterUniqueTogether(
            name='location',
            unique_together={('id', 'company')},
        ),
        migrations.AlterUniqueTogether(
            name='eventclass',
            unique_together={('id', 'company')},
        ),
        migrations.AlterUniqueTogether(
            name='event',
            unique_together={('event_class', 'date')},
        ),
        migrations.AlterUniqueTogether(
            name='dayoftheweekclass',
            unique_together={('day', 'event')},
        ),
        migrations.AlterUniqueTogether(
            name='coach',
            unique_together={('id', 'company')},
        ),
        migrations.AlterUniqueTogether(
            name='client',
            unique_together={('company', 'name')},
        ),
        migrations.AlterUniqueTogether(
            name='attendance',
            unique_together={('client', 'event')},
        ),
        migrations.RunPython(create_admin_company),
    ]