示例#1
0
class AccountTeam(models.Model):
    class Meta:
        verbose_name = "队伍成员"
        verbose_name_plural = "队伍成员表"
        app_label = 'team'

    # 队伍关联
    team = models.ForeignKey('team.Team', on_delete=models.CASCADE)

    # 账户关联
    account = models.ForeignKey('account.Account', on_delete=models.CASCADE)

    # 角色
    role = models.PositiveSmallIntegerField(**TeamRoleEnum.get_models_params())

    # 空闲与否
    free = models.BooleanField(default=True)

    # 创建时间(入队时间)
    create_time = TimeStampField(auto_now_add=True)

    # 更新时间
    update_time = TimeStampField(auto_now=True)

    # 重构管理器
    objects = FireHydrantModelManager()

    def __str__(self):
        return '[{}] 队伍名称: {}, 昵称: {}, 空闲与否: {}'.format(
            self.id, self.team.nickname, self.account.nickname, self.free)
示例#2
0
class FaceUGroups(models.Model):
    class Meta:
        verbose_name = "脸你分组"
        verbose_name_plural = "脸你分组表"
        app_label = 'faceU'

    # 归属用户
    author = models.ForeignKey('faceU.FaceUAccount',
                               null=True,
                               blank=True,
                               on_delete=models.SET_NULL)

    # 标题
    title = models.CharField(max_length=255)

    # 描述
    description = models.CharField(max_length=255)

    # 创建时间
    create_time = TimeStampField(auto_now_add=True)

    # 最后更新时间
    update_time = TimeStampField(auto_now=True)

    # 重构管理器
    objects = FireHydrantModelManager()

    def __str__(self):
        return '[{}] 归属人: {}, 标题: {}'.format(self.id, self.author.nickname,
                                             self.title)
示例#3
0
class PayAccount(models.Model):
    class Meta:
        verbose_name = '支付虚拟账户'
        verbose_name_plural = '支付虚拟账户表'
        app_label = 'pay'

    # 绑定账号
    account = models.ForeignKey('account.Account', on_delete=models.CASCADE)

    # 支付账号
    payment = models.TextField(default=PayTypeEntity().dumps())

    # 当前总金额
    total_amount = models.FloatField(default=0.0)

    # 可用金额(不包括任务ing的冻结金额)
    available_amount = models.FloatField(default=0.0)

    # 创建时间
    create_time = TimeStampField(auto_now_add=True)

    # 最后更新时间
    update_time = TimeStampField(auto_now=True)

    # 重构管理器
    objects = FireHydrantModelManager()

    def __str__(self):
        return '[{}] 昵称: {:20s} 邮箱: {:50d}'.format(self.id,
                                                   self.account.nickname,
                                                   self.account.username)
示例#4
0
class FaceUDistinguishRecord(models.Model):
    class Meta:
        verbose_name = "脸你识别记录"
        verbose_name_plural = "脸你识别记录表"
        app_label = 'faceU'

    # 归属人
    author = models.ForeignKey('faceU.FaceUAccount',
                               null=True,
                               blank=True,
                               on_delete=models.SET_NULL)

    # 分组
    group = models.ForeignKey('faceU.FaceUGroups',
                              null=True,
                              blank=True,
                              on_delete=models.SET_NULL)

    # 结果
    result = models.TextField(default='')

    # 创建时间
    create_time = TimeStampField(auto_now_add=True)

    # 最后更新时间
    update_time = TimeStampField(auto_now=True)

    # 重构管理器
    objects = FireHydrantModelManager()

    def __str__(self):
        return '[{}] 归属: [{}] {}, 分组: [{}]{}'.format(
            self.id, self.author_id, self.author.nickname, self.group_id,
            self.group.title if self.group_id else '')
示例#5
0
class PracticeTag(models.Model):
    class Meta:
        verbose_name = "爱阅读后台管理标签"
        verbose_name_plural = "爱阅读后台管理标签表"
        app_label = 'practice'

    # 名称
    name = models.CharField(max_length=125)

    # 父节点
    parent = models.ForeignKey('self',
                               null=True,
                               blank=True,
                               on_delete=models.CASCADE)

    # 创建时间
    create_time = TimeStampField(auto_now_add=True)

    # 更新时间
    update_time = TimeStampField(auto_now=True)

    # 重构管理器
    objects = FireHydrantModelManager()

    def __str__(self):
        return '[{}] 名称: {}'.format(self.id, self.name)
示例#6
0
class PracticeClassroomUser(models.Model):
    class Meta:
        verbose_name = "爱阅读后台管理教室使用"
        verbose_name_plural = "爱阅读后台管理教室使用表"
        app_label = 'practice'

    # 创建人
    author = models.ForeignKey('account.Account', on_delete=models.CASCADE)

    # 教室
    classroom = models.ForeignKey('practice.PracticeClassroom',
                                  on_delete=models.CASCADE)

    # 排课
    arrangement = models.ForeignKey('practice.PracticeArrangement',
                                    on_delete=models.CASCADE)

    # 创建时间
    create_time = TimeStampField(auto_now_add=True)

    # 更新时间
    update_time = TimeStampField(auto_now=True)

    # 重构管理器
    objects = FireHydrantModelManager()

    def __str__(self):
        return '[{}] 教室: {}, 排课: {}'.format(self.id, self.classroom_id,
                                            self.arrangement_id)
示例#7
0
class TaskApply(models.Model):
    class Meta:
        verbose_name = "任务申请"
        verbose_name_plural = "任务申请表"
        app_label = 'task'

    # 关联关联
    task = models.ForeignKey('task.Task', on_delete=models.CASCADE)

    # 提交者
    author = models.ForeignKey('account.Account', on_delete=models.CASCADE)

    # 正文
    content = models.TextField(default='')

    # 成就展示
    exhibition = models.ManyToManyField('account.AccountExhibition',
                                        null=True,
                                        blank=True,
                                        related_name='task_account_exhibition')

    # 重构管理器
    objects = FireHydrantModelManager()

    # 创建时间
    create_time = TimeStampField(auto_now_add=True)

    # 最后更新时间
    update_time = TimeStampField(auto_now=True)

    def __str__(self):
        return "[{}] author: {}, task: {}".format(self.id,
                                                  self.author.nickname,
                                                  self.task.title)
示例#8
0
class PracticeClassroom(models.Model):
    class Meta:
        verbose_name = "爱阅读后台管理教室"
        verbose_name_plural = "爱阅读后台管理教室表"
        app_label = 'practice'

    # 学校
    school = models.ForeignKey('practice.PracticeSchool',
                               on_delete=models.CASCADE)

    # 大小
    size = models.IntegerField(default=0)

    # 名称
    name = models.CharField(max_length=125)

    # 创建时间
    create_time = TimeStampField(auto_now_add=True)

    # 更新时间
    update_time = TimeStampField(auto_now=True)

    # 重构管理器
    objects = FireHydrantModelManager()

    def __str__(self):
        return '[{}] 学校: {}, 名称: {}'.format(self.id, self.school.name,
                                            self.name)
示例#9
0
class PracticeSchool(models.Model):
    class Meta:
        verbose_name = "爱阅读后台管理学校"
        verbose_name_plural = "爱阅读后台管理学校表"
        app_label = 'practice'

    # 学校名称
    name = models.CharField(max_length=255)

    # 学校logo
    logo = models.CharField(max_length=200, default='', blank=True)

    # 简介
    description = models.TextField(default="")

    # 创建时间
    create_time = TimeStampField(auto_now_add=True)

    # 更新时间
    update_time = TimeStampField(auto_now=True)

    # 重构管理器
    objects = FireHydrantModelManager()

    def __str__(self):
        return '[{}] 学校名称:{}'.format(self.id, self.name)
示例#10
0
class TaskReport(models.Model):
    class Meta:
        verbose_name = "任务进度汇报"
        verbose_name_plural = "任务进度汇报表"
        app_label = 'task'

    # 关联关联
    task = models.ForeignKey('task.Task', on_delete=models.CASCADE)

    # 附属资源
    resource = models.ManyToManyField('resources.ResourcesMeta',
                                      null=True,
                                      blank=True,
                                      related_name='task_report_resources')

    # 总结
    summary = models.TextField(default="", blank=True)

    # 阶段
    index = models.IntegerField(default=0)

    # 创建时间
    create_time = TimeStampField(auto_now_add=True)

    # 最后更新时间
    update_time = TimeStampField(auto_now=True)

    # 重构管理器
    objects = FireHydrantModelManager()

    def __str__(self):
        return "[{}] {}".format(self.id, self.task.title)
示例#11
0
class FaceUFacialMakeup(models.Model):
    class Meta:
        verbose_name = "脸你脸谱"
        verbose_name_plural = "脸你脸谱表"
        app_label = 'faceU'

    # 脸谱uuid
    face_uuid = models.CharField(max_length=255)

    # 名称
    name = models.CharField(max_length=125)

    # 身份证
    id_code = models.CharField(max_length=30, null=True, blank=True)

    # 性别
    sex = models.PositiveSmallIntegerField(**
                                           AccountSexEnum.get_models_params(),
                                           null=True,
                                           blank=True)

    # 创建时间
    create_time = TimeStampField(auto_now_add=True)

    # 最后更新时间
    update_time = TimeStampField(auto_now=True)

    # 重构管理器
    objects = FireHydrantModelManager()

    def __str__(self):
        return '[{}] uuid: {}, 姓名: {}, 身份证: {}'.format(self.id, self.face_uuid,
                                                       self.name, self.id_code)
示例#12
0
class ResourcesMeta(models.Model):
    class Meta:
        verbose_name = "资源元数据记录"
        verbose_name_plural = "资源元数据记录表"
        app_label = 'resources'

    # 文件名称(禁止为空)
    name = models.CharField(max_length=255)

    # MIME类型
    mime = models.CharField(max_length=100)

    # 文件大小
    size = models.BigIntegerField(default=0)

    # 文件Hash
    hash = models.CharField(max_length=255, blank=True, null=True, default="")

    # 创建时间
    create_time = TimeStampField(auto_now_add=True)

    # 重构管理器
    objects = FireHydrantModelManager()

    def __str__(self):
        return "[{}] {}".format(self.id, self.name)
示例#13
0
class PracticeStudentUser(models.Model):
    class Meta:
        verbose_name = "爱阅读后台管理学生账户"
        verbose_name_plural = "爱阅读后台管理学生账户表"
        app_label = 'practice'

    # 账号关联
    account = models.ForeignKey('account.Account', on_delete=models.CASCADE)

    # 学校关联
    school = models.ForeignKey('practice.PracticeSchool',
                               on_delete=models.CASCADE)

    # 学号
    code = models.CharField(max_length=255)

    # 真实名称
    realname = models.CharField(max_length=255)

    # 创建时间
    create_time = TimeStampField(auto_now_add=True)

    # 更新时间
    update_time = TimeStampField(auto_now=True)

    # 重构管理器
    objects = FireHydrantModelManager()

    def __str__(self):
        return '[{}] 学校名称: {}, 真实名称: {}'.format(self.id, self.school.name,
                                                self.realname)
示例#14
0
class FaceUAccount(models.Model):
    """
    FireHydrant用户账户主类
    """
    class Meta:
        verbose_name = "脸你主账户"
        verbose_name_plural = "脸你主账户表"
        app_label = 'faceU'

    # Email用户名
    username = models.CharField(max_length=255)

    # === 基础信息  ===

    # 用户性别
    sex = models.PositiveSmallIntegerField(
        **AccountSexEnum.get_models_params())

    # 密码
    password = models.CharField(max_length=255)

    # 用户昵称
    nickname = models.CharField(max_length=50, default="")

    # 用户角色
    role = models.PositiveSmallIntegerField(
        **AccountRoleEnum.get_models_params())

    # 电话信息
    phone = models.CharField(max_length=20, default='', blank=True)

    # 电话已通过验证(留着吧,未来可能启用)
    phone_validated = models.BooleanField(default=False)

    # 用户头像
    avator = models.CharField(max_length=200, default='', blank=True)

    # 一句话签名
    motto = models.CharField(max_length=60, default='', blank=True)

    # ==== 扩展信息 ====

    # 创建时间
    create_time = TimeStampField(auto_now_add=True)

    # 最后更新时间
    update_time = TimeStampField(auto_now=True)

    # 账户权限信息
    options = models.TextField(default='{}')

    # token
    temp_access_token = models.CharField(max_length=100)

    # 重构管理器
    objects = FireHydrantModelManager()

    def __str__(self):
        return '[%d] 昵称:%s, 角色:%s' % (self.id, self.nickname, str(self.role))
示例#15
0
class PracticeArrangement(models.Model):
    class Meta:
        verbose_name = "爱阅读后台管理课程排课"
        verbose_name_plural = "爱阅读后台管理课程排课表"
        app_label = 'practice'

    # 课程
    course = models.ForeignKey('practice.PracticeCourse',
                               on_delete=models.CASCADE)

    # 排课名称
    name = models.CharField(max_length=50, blank=True, default="")

    # 周几
    day_of_week = models.PositiveSmallIntegerField(default=0)

    # 开始周
    start_week = models.PositiveSmallIntegerField(default=0)

    # 结束周
    end_week = models.PositiveSmallIntegerField(default=0)

    # 单双周
    odd_even = models.PositiveSmallIntegerField(
        **OddEvenEnum.get_models_params())

    # 开始节
    start_section = models.PositiveSmallIntegerField(default=0)

    # 结束节
    end_section = models.PositiveSmallIntegerField(default=0)

    # 开始时间(24小时)
    start_time = models.PositiveIntegerField(default=0)

    # 结束时间(24小时)
    end_time = models.PositiveIntegerField(default=0)

    # 学生信息(选课信息)
    students = models.ManyToManyField(
        'practice.PracticeStudentUser',
        blank=True,
        related_name='course_arrangement_student')

    # 创建时间(入队时间)
    create_time = TimeStampField(auto_now_add=True)

    # 更新时间
    update_time = TimeStampField(auto_now=True)

    # 重构管理器
    objects = FireHydrantModelManager()

    def __str__(self):
        return '[{}] 关联课程: {}, 排课名称: {}'.format(self.id, self.course.name,
                                                self.name)
示例#16
0
class PracticeCourse(models.Model):
    class Meta:
        verbose_name = "爱阅读后台管理课程"
        verbose_name_plural = "爱阅读后台管理课程表"
        app_label = 'practice'

    # 学校
    school = models.ForeignKey('practice.PracticeSchool',
                               on_delete=models.CASCADE)

    # 创建人
    author = models.ForeignKey('account.Account',
                               on_delete=models.SET_NULL,
                               null=True,
                               blank=True)

    # 标签
    tag = models.ForeignKey('practice.PracticeTag',
                            on_delete=models.SET_NULL,
                            null=True,
                            blank=True)

    # 名称
    name = models.CharField(max_length=125)

    # 简介
    description = models.CharField(max_length=255)

    # 开始时间
    start_time = TimeStampField(default=0)

    # 结束时间
    end_time = TimeStampField(default=0)

    # 创建时间
    create_time = TimeStampField(auto_now_add=True)

    # 更新时间
    update_time = TimeStampField(auto_now=True)

    # 重构管理器
    objects = FireHydrantModelManager()

    def __str__(self):
        return '[{}] 名称: {}, 归属学校: {}'.format(self.id, self.name,
                                              self.school.name)
示例#17
0
class PracticeEvaluateBase(models.Model):
    class Meta:
        abstract = True

    # 评分
    star = models.PositiveSmallIntegerField(default=0)

    # 评语
    message = models.TextField(default="")

    # 创建时间
    create_time = TimeStampField(auto_now_add=True)

    # 更新时间
    update_time = TimeStampField(auto_now=True)

    # 重构管理器
    objects = FireHydrantModelManager()
示例#18
0
class PracticeAttendance(models.Model):
    class Meta:
        verbose_name = "爱阅读后台管理课程考勤"
        verbose_name_plural = "爱阅读后台管理课程考勤表"
        app_label = 'practice'

    # 学校
    school = models.ForeignKey('practice.PracticeSchool',
                               on_delete=models.CASCADE)

    # 课程
    course = models.ForeignKey('practice.PracticeCourse',
                               on_delete=models.CASCADE)

    # 排课
    arrangement = models.ForeignKey('practice.PracticeArrangement',
                                    on_delete=models.CASCADE)

    # 学生
    student = models.ForeignKey('practice.PracticeStudentUser',
                                on_delete=models.CASCADE)

    # 请假
    leaver = models.IntegerField(default=0)

    # 缺勤
    absent = models.IntegerField(default=0)

    # 迟到
    late = models.IntegerField(default=0)

    # 创建时间
    create_time = TimeStampField(auto_now_add=True)

    # 更新时间
    update_time = TimeStampField(auto_now=True)

    # 重构管理器
    objects = FireHydrantModelManager()

    def __str__(self):
        return '[{}] 学校: {}, 课程: {}, 排课: {}, 学生: {}'.format(
            self.id, self.school_id, self.course_id, self.arrangement_id,
            self.student_id)
示例#19
0
class Team(models.Model):
    class Meta:
        verbose_name = "队伍"
        verbose_name_plural = "队伍表"
        app_label = 'team'

    # 队伍名称
    nickname = models.CharField(default="", max_length=140)

    # 队长
    leader = models.ForeignKey('account.Account',
                               null=True,
                               on_delete=models.SET_NULL,
                               related_name='team_leader')

    # 口号
    slogan = models.CharField(default="", max_length=255)

    # 最大成员数量
    maximum_number = models.PositiveSmallIntegerField(
        **TeamMaximumNumberEnum.get_models_params())

    # 是否满员
    full = models.BooleanField(default=False)

    # 入队密码
    password = models.CharField(max_length=140, blank=True, default='')

    # 是否为公开队伍
    public = models.BooleanField(default=False)

    # 创建时间
    create_time = TimeStampField(auto_now_add=True)

    # 更新时间
    update_time = TimeStampField(auto_now=True)

    # 重构管理器
    objects = FireHydrantModelManager()

    def __str__(self):
        return '[{}] 队伍名称: {}, 公开与否: {}'.format(self.id, self.nickname,
                                                self.public)
示例#20
0
class PayRecord(models.Model):
    """
    交易记录表
    """
    class Meta:
        verbose_name = '交易记录'
        verbose_name_plural = '交易记录表'
        app_label = 'pay'

    # 关联账户
    account = models.ForeignKey('account.Account',
                                on_delete=models.CASCADE,
                                related_name='pay_record_account')

    # 支付类型
    pay_type = models.PositiveSmallIntegerField(
        **PayTypeEnum.get_models_params())

    # 目标账户
    target = models.ForeignKey('account.Account',
                               on_delete=models.SET_NULL,
                               blank=True,
                               null=True,
                               related_name='pay_record_target')

    # 支付金额
    amount = models.FloatField(default=0.0)

    # 创建时间
    create_time = TimeStampField(auto_now_add=True)

    # 最后更新时间
    update_time = TimeStampField(auto_now=True)

    # 重构管理器
    objects = FireHydrantModelManager()

    def __str__(self):
        return "[{}] 发起账户: {} 创建时间: {}".format(self.id, self.account.nickname,
                                               self.create_time)
示例#21
0
class AccountExhibition(models.Model):
    class Meta:
        verbose_name = "用户作品展示"
        verbose_name_plural = "用户作品展示表"
        app_label = 'account'

    #  关联用户
    account = models.ForeignKey('account.Account', on_delete=models.CASCADE)

    # 标题
    title = models.CharField(max_length=255)

    # 正文
    content = models.TextField(default='')

    # 是否展示
    show = models.BooleanField(default=True)

    # 资源文件关联
    resource = models.ManyToManyField(
        'resources.ResourcesMeta',
        null=True,
        blank=True,
        related_name='account_exhibition_resources')

    # 创建时间
    create_time = TimeStampField(auto_now_add=True)

    # 最后更新时间
    update_time = TimeStampField(auto_now=True)

    # 重构管理器
    objects = FireHydrantModelManager()

    def __str__(self):
        return "[{}] account: {} , title: {}".format(self.id,
                                                     self.account.nickname,
                                                     self.title)
示例#22
0
class TaskClassification(models.Model):
    class Meta:
        verbose_name = "任务分类"
        verbose_name_plural = "任务分类表"
        app_label = 'task'

    # 分类名称
    name = models.CharField(max_length=125)

    # 描述
    description = models.CharField(max_length=255, default='', blank=True)

    # 父节点
    parent = models.ForeignKey('self',
                               on_delete=models.CASCADE,
                               blank=True,
                               null=True)

    # 重构管理器
    objects = FireHydrantModelManager()

    def __str__(self):
        return "[{}] 分类名称: {}".format(self.id, self.name)
示例#23
0
class FaceUFacialMakeupMapping(models.Model):
    class Meta:
        verbose_name = "脸你脸谱分组映射"
        verbose_name_plural = "脸你脸谱分组映射表"
        app_label = 'faceU'

    # 脸谱uuid
    face = models.ForeignKey('faceU.FaceUFacialMakeup',
                             null=True,
                             blank=True,
                             on_delete=models.SET_NULL)

    # 分组
    group = models.ForeignKey('faceU.FaceUGroups',
                              null=True,
                              blank=True,
                              on_delete=models.SET_NULL)

    # 名称
    name = models.CharField(max_length=125)

    # 用户自定义标识
    code = models.CharField(max_length=125, null=True, blank=True)

    # 创建时间
    create_time = TimeStampField(auto_now_add=True)

    # 最后更新时间
    update_time = TimeStampField(auto_now=True)

    # 重构管理器
    objects = FireHydrantModelManager()

    def __str__(self):
        return '[{}] 脸: [{}]{}, 分组: [{}]{}, 姓名: {}, 标识: {}'.format(
            self.id, self.face_id, self.face.name, self.group_id,
            self.group.title, self.name, self.code)
示例#24
0
class Task(models.Model):
    class Meta:
        verbose_name = "任务"
        verbose_name_plural = "任务表"
        app_label = 'task'

    # 发起人
    author = models.ForeignKey('account.Account',
                               on_delete=models.CASCADE,
                               related_name='task_author')

    # 标题
    title = models.CharField(max_length=255)

    # 任务内容
    content = models.TextField(default="")

    # 附属资源
    resource = models.ManyToManyField('resources.ResourcesMeta',
                                      null=True,
                                      blank=True,
                                      related_name='task_resources')

    # 任务类型(默认个人任务)
    task_type = models.IntegerField(default=TaskTypeEnum.PERSONAL)

    # 当前处在任务阶段(默认发布期)
    stage = models.IntegerField(default=TaskStageEnum.RELEASE)

    # 任务分类
    classification = models.ForeignKey('task.TaskClassification',
                                       on_delete=models.SET_NULL,
                                       null=True)

    # 配置
    config = models.TextField(default='{}')

    # 发布最终确认时间
    publish_end_time = models.FloatField(default=0.0)

    # 开发时长
    development_time = models.FloatField(default=0.0)

    # 委托金
    commission = models.FloatField(default=0.0)

    # ======== 委托信息 ========

    # 受托方队长
    leader = models.ForeignKey('account.Account',
                               blank=True,
                               on_delete=models.SET_NULL,
                               null=True,
                               related_name='task_leader')

    # 受托人
    workers = models.ManyToManyField('account.Account',
                                     blank=True,
                                     null=True,
                                     related_name='task_workers')

    # 创建时间
    create_time = TimeStampField(auto_now_add=True)

    # 最后更新时间
    update_time = TimeStampField(auto_now=True)

    # 重构管理器
    objects = FireHydrantModelManager()

    def __str__(self):
        return "[{}] 标题:{} 发起人:{}".format(self.id, self.title,
                                          self.author.nickname)