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)
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)
class InterviewRegistrationTemplate(models.Model): class Meta: verbose_name = "报名表模版" verbose_name_plural = "报名表模版表" app_label = 'interview' # 关联协会 association = models.ForeignKey('association.Association', on_delete=models.CASCADE) # 创建人 author = models.ForeignKey('association.AssociationAccount', blank=True, on_delete=models.SET_NULL, null=True) # 标题 title = models.CharField(max_length=255) # 配置 config = models.TextField(default='{}') # 创建时间 create_time = TimeStampField(auto_now_add=True) # 最后更新时间 update_time = TimeStampField(auto_now=True) # 重构管理器 objects = HoHoModelManager() def __str__(self): return "[{}]{} {}".format(self.id, self.association.name, self.title)
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)
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 '')
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)
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)
class InterviewRegistration(models.Model): class Meta: verbose_name = "报名表" verbose_name_plural = "报名表" app_label = 'interview' # 关联协会 association = models.ForeignKey('association.Association', on_delete=models.CASCADE) # 版本号 version = models.FloatField(default=0.0) # 关联账户 account = models.ForeignKey('account.Account', on_delete=models.CASCADE) # 正文信息 content = models.TextField(default='{}') # 创建时间 create_time = TimeStampField(auto_now_add=True) # 最后更新时间 update_time = TimeStampField(auto_now=True) # 重构管理器 objects = HoHoModelManager() def __str__(self): return "[{}] {} {}".format(self.id, self.association.name, self.account.realname)
class AppraisingScoreTemplate(models.Model): class Meta: verbose_name = "评分模板" verbose_name_plural = "评分模板表" app_label = 'appraising' # 发起人 author = models.ForeignKey('association.AssociationAccount', blank=True, on_delete=models.SET_NULL, null=True) # 关联协会 association = models.ForeignKey('association.Association', on_delete=models.CASCADE) # 标题 title = models.CharField(max_length=255) # 配置 目前只支持单选题目形式 config = models.TextField(default="[]") # 创建时间 create_time = TimeStampField(auto_now_add=True) # 最后更新时间 update_time = TimeStampField(auto_now=True) # 重构管理器 objects = HoHoModelManager() def __str__(self): return "[{}] {} {}".format(self.id, self.title, self.association.name)
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)
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)
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)
class AssociationCurriculum(models.Model): """ 无课表 """ class Meta: verbose_name = "无课表" verbose_name_plural = "无课表" app_label = 'scheduling' # 标题 title = models.CharField(max_length=100) # 协会 association = models.ForeignKey('association.Association', on_delete=models.CASCADE) # 内容 content = models.TextField(default='{}') # 创建时间 create_time = TimeStampField(auto_now_add=True) # 最后更新时间 update_time = TimeStampField(auto_now=True) # 重构管理器 objects = HoHoModelManager() def __str__(self): return "%d %s" % (self.id, self.title)
class School(models.Model): class Meta: verbose_name = "学校" verbose_name_plural = "学校表" app_label = 'school' # 学校名称 name = models.CharField(max_length=50) # 学校缩写(小写) short_name = models.CharField(max_length=10, default="", blank=True) # 学校标志(图像文件) logo = models.CharField(max_length=255, default="", blank=True) # 学校简介 description = models.CharField(max_length=255, default="", blank=True) # 学校配置信息(目前为学校课表配置) config = models.TextField(default=SchoolEntity().dumps()) # 创建时间 create_time = TimeStampField(auto_now_add=True) # 最后更新时间 update_time = TimeStampField(auto_now=True) # 重构管理器 objects = HoHoModelManager() def __str__(self): return "[%s] %s(%s)" % (self.id, self.name, self.short_name)
class AssociationTaskReport(models.Model): class Meta: verbose_name = "任务进度汇报" verbose_name_plural = "任务进度汇报表" app_label = 'task' # 关联关联 task = models.ForeignKey('task.AssociationTask', on_delete=models.CASCADE) # 完成人 worker = models.ForeignKey('association.AssociationAccount', blank=True, on_delete=models.SET_NULL, null=True) # 是否已完成 complete = models.BooleanField(default=False) # 总结 summary = models.TextField(default="") # 创建时间 create_time = TimeStampField(auto_now_add=True) # 最后更新时间 update_time = TimeStampField(auto_now=True) # 重构管理器 objects = HoHoModelManager() def __str__(self): return "[{}] {} {}".format(self.id, self.task.title, self.worker.nickname)
class AssociationAccountCurriculum(models.Model): """ 用户无课表 """ class Meta: verbose_name = "用户无课表" verbose_name_plural = "用户无课表" app_label = 'scheduling' # 用户 account = models.ForeignKey('association.AssociationAccount', on_delete=models.CASCADE) # 无课表 curriculum = models.ForeignKey('scheduling.AssociationCurriculum', on_delete=models.CASCADE) # 内容 content = models.TextField(default='{}') # 创建时间 create_time = TimeStampField(auto_now_add=True) # 最后更新时间 update_time = TimeStampField(auto_now=True) # 重构管理器 objects = HoHoModelManager() def __str__(self): return "{} {} {}".format(self.id, self.account.account.realname, self.curriculum.title)
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)
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)
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)
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))
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)
class AppraisingScore(models.Model): class Meta: verbose_name = "评分" verbose_name_plural = "评分表" app_label = 'appraising' # 填写人 author = models.ForeignKey('association.AssociationAccount', blank=True, on_delete=models.SET_NULL, null=True, related_name='appraising_score_author') # 版本号 version = models.IntegerField(default=0) # 关联协会 association = models.ForeignKey('association.Association', on_delete=models.CASCADE) # 面向对象 target = models.ForeignKey('association.AssociationAccount', on_delete=models.CASCADE, related_name='appraising_score_target') # 使用模版 template = models.ForeignKey('appraising.AppraisingScoreTemplate', on_delete=models.CASCADE) # 正文 content = models.TextField(default="{}") # 创建时间 create_time = TimeStampField(auto_now_add=True) # 最后更新时间 update_time = TimeStampField(auto_now=True) # 总分 score = models.FloatField(default=0.0) # 重构管理器 objects = HoHoModelManager() def __str__(self): return "[{}] {}->{} {}".format(self.id, self.author.nickname, self.target.nickname, self.association.name)
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)
class Association(models.Model): class Meta: verbose_name = "协会" verbose_name_plural = "协会表" app_label = 'association' # 归属学校 school = models.ForeignKey('school.School', on_delete=models.CASCADE) # 协会名称 name = models.CharField(max_length=50) # 协会缩写(小写) short_name = models.CharField(max_length=10, default="", db_index=True) # 协会标志(图像文件) logo = models.CharField(max_length=255, default="", blank=True) # 协会简介 description = models.CharField(max_length=255, default="", blank=True) # 代办事项 backlog = models.TextField(default=AssociationBacklog().dumps()) # 协会配置信息(评优配置数据) config = models.TextField(default=AssociationConfigureEntity().dumps()) # 是否集群(有无部门)模式 colony = models.BooleanField(default=False) # 协会仓库最大空间(默认2G) repository_size = models.BigIntegerField(default=2147483648) # 协会码 choosing_code = models.CharField(default='', max_length=15, blank=True) # 创建时间 create_time = TimeStampField(auto_now_add=True) # 最后更新时间 update_time = TimeStampField(auto_now=True) # 重构管理器 objects = HoHoModelManager() def __str__(self): return "[%s] %s(%s)" % (self.id, self.name, self.short_name)
class AssociationAttendance(models.Model): class Meta: verbose_name = "协会考勤" verbose_name_plural = "协会考勤表" app_label = 'association' # 考勤名称 title = models.CharField(max_length=64, default="") # 考勤发起者 author = models.ForeignKey('association.AssociationAccount', null=True, on_delete=models.SET_NULL) # 归属协会 association = models.ForeignKey('association.Association', on_delete=models.CASCADE) # 归属部门 department = models.ForeignKey('association.AssociationDepartment', on_delete=models.CASCADE, null=True, blank=True) # 描述 description = models.TextField(default="", blank=True) # 考勤地点(纬度) place_x = models.FloatField(default=0.0) # 考勤地点(经度) place_y = models.FloatField(default=0.0) # 容错距离(半径m) distance = models.FloatField(default=50.0) # 开始时间 start_time = models.FloatField(default=0.0) # 结束时间 end_time = models.FloatField(default=0.0) # 创建时间 create_time = TimeStampField(auto_now_add=True) # 最后更新时间 update_time = TimeStampField(auto_now=True) # 重构管理器 objects = HoHoModelManager() def __str__(self): return "[%s] 标题:%s, 归属协会%s" % (self.id, self.title, self.association.name)
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)
class AssociationScheduling(models.Model): """ 排班表 """ class Meta: verbose_name = "协会排班" verbose_name_plural = "协会排班表" app_label = 'scheduling' # 发起人 author = models.ForeignKey('association.AssociationAccount', on_delete=models.SET_NULL, null=True, blank=True) # 协会关联 association = models.ForeignKey('association.Association', on_delete=models.CASCADE) # 标题 title = models.CharField(max_length=255) # 配置 config = models.TextField(default="{}") # 排班表 content = models.TextField(default="{}") # 开始时间 start_time = models.FloatField(default=0.0) # 结束时间 end_time = models.FloatField(default=0.0) # 创建时间 create_time = TimeStampField(auto_now_add=True) # 最后更新时间 update_time = TimeStampField(auto_now=True) # 重构管理器 objects = HoHoModelManager() def __str__(self): return "[{}] {} {}".format(self.id, self.title, self.association.name)
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()
class AssociationTask(models.Model): class Meta: verbose_name = "任务" verbose_name_plural = "任务表" app_label = 'task' # 发起人 author = models.ForeignKey('association.AssociationAccount', on_delete=models.CASCADE) # 关联协会 association = models.ForeignKey('association.Association', on_delete=models.CASCADE) # 关联部门 department = models.ForeignKey('association.AssociationDepartment', on_delete=models.CASCADE, blank=True, null=True) # 标题 title = models.CharField(max_length=255) # 任务内容 content = models.TextField(default="") # 开始时间 start_time = models.FloatField(default=0.0) # 结束时间 end_time = models.FloatField(default=0.0) # 是否正在进行 working = models.BooleanField(default=False) # 执行人数 number = models.IntegerField(default=1) # 创建时间 create_time = TimeStampField(auto_now_add=True) # 最后更新时间 update_time = TimeStampField(auto_now=True) # 重构管理器 objects = HoHoModelManager() def __str__(self): return "[{}] 标题:{} 发起人:{}".format(self.id, self.title, self.author.nickname)
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)