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 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 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 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 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 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 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 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 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 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 AssociationAccount(models.Model): class Meta: verbose_name = "协会人事" verbose_name_plural = "协会人事表" app_label = 'association' # 协会内名称 nickname = models.CharField(max_length=50, default="") # 关联用户 account = models.ForeignKey('account.Account', on_delete=models.CASCADE) # 关联协会 association = models.ForeignKey('association.Association', on_delete=models.CASCADE) # 关联部门 department = models.ForeignKey('association.AssociationDepartment', on_delete=models.CASCADE, null=True, blank=True) # 用户角色 role = models.PositiveSmallIntegerField(**RoleEnum.get_models_params()) # 权限 permissions = models.TextField(default=AssociationPermissionsEntity().dumps()) # 退休换届与否 retire = models.BooleanField(default=False) # 创建时间 create_time = TimeStampField(auto_now_add=True) # 最后更新时间 update_time = TimeStampField(auto_now=True) # 重构管理器 objects = HoHoModelManager() def __str__(self): return "[%d]\t%s\t%s\t%s" % (self.id, self.role, self.nickname, self.association.name)
class AssociationNotice(models.Model): class Meta: verbose_name = "通知" verbose_name_plural = "通知表" app_label = 'notice' # 发起人 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) # 创建时间 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 AssociationDepartment(models.Model): class Meta: verbose_name = "部门" verbose_name_plural = "部门表" app_label = 'association' # 部门名称 name = models.CharField(max_length=64, default="") # 部门缩写(小写) short_name = models.CharField(max_length=10, default="", db_index=True) # 部门简介 description = models.CharField(max_length=255, default="", blank=True) # 部门配置信息(用户可以改动的部分) config = models.TextField(default='{}') # 归属协会 association = models.ForeignKey('association.Association', on_delete=models.CASCADE) # 部长 manager = models.ManyToManyField('association.AssociationAccount', blank=True, related_name='department_manager') # 创建时间 create_time = TimeStampField(auto_now_add=True) # 最后更新时间 update_time = TimeStampField(auto_now=True) # 重构管理器 objects = HoHoModelManager() def __str__(self): return "[{}]{}:{}".format(self.id, self.name, self.association.name)
class RepositoryFile(models.Model): class Meta: verbose_name = "文件" verbose_name_plural = "文件表" # 上传者 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) # 描述 description = models.TextField(default="") # 文件地址 path = models.CharField(max_length=200, default='', blank=True) # 创建时间 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, self.author.nickname)
class Account(models.Model): """ LittlePigHoHo用户账户主类 """ class Meta: verbose_name = "LittlePigHoHo主账户" verbose_name_plural = "LittlePigHoHo主账户表" app_label = 'account' # Email email = models.CharField(default='', blank=True, max_length=125) # Email 已通过验证 email_validated = models.BooleanField(default=False) # === 基础信息 === # 用户性别 sex = models.PositiveSmallIntegerField(**SexEnum.get_models_params()) # 用户昵称 nickname = models.CharField(max_length=50, default="") # 真实姓名 realname = models.CharField(max_length=50, default="") # 用户角色 role = models.PositiveSmallIntegerField(**RoleEnum.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) # 账户权限信息 permissions = models.TextField(default='{}') # token temp_access_token = models.CharField(max_length=100) # 重构管理器 objects = HoHoModelManager() def __str__(self): return '[%d] 昵称:%s, 角色:%s ,token: %s' % ( self.id, self.nickname, str(self.role), self.temp_access_token)