def get_team_info(self): """ 获取队伍信息 :return: """ if self.team is None: return dict() return model_to_dict(self.team, self.NORMAL_FIELD)
def get_attendance_info(self): """ 获取考勤记录信息 :return: """ if not self.attendance: return {} return model_to_dict(self.attendance, self.NORMAL_FIELDS)
def get_registration_info(self): """ 获取报名表信息 :return: """ if self.registration is None: return return model_to_dict(self.registration, self.FIELD)
def get_score_template_info(self): """ 获取评分模版信息 :return: """ if self.score_template is None: return return model_to_dict(self.score_template, self.FIELD)
def get_curriculum_info(self): """ 获取无课表信息 :return: """ if self.curriculum is None: return return model_to_dict(self.curriculum, self.FIELD)
def get_studentuser_info(self): """ 获取学生信息 :return: """ if not self.studentuser: return {} return model_to_dict(self.studentuser, self.NORMAL_FIELDS)
def get_arrangement_info(self): """ 获取排课信息 :return: """ if self.arrangement is None: return {} return model_to_dict(self.arrangement, self.NORMAL_FIELDS)
def get_task_report_info(self): """ 获取任务进度汇报信息 :return: """ if self.task_report is None: raise TaskInfoExcept.no_working() return model_to_dict(self.task_report, self.TASK_REPORT_FIELD)
def get_arrangement_student_info(self): """ 获取排课学生信息 :return: """ if self.arrangement is None: return [] return model_to_dict(self.arrangement, self.STUDENT)['students']
def get_evaluate_info(self): """ 获取评价信息 :return: """ if not self.evaluate: return {} return model_to_dict(self.evaluate, self.NORMAL_FIELDS)
def get_tag_info(self): """ 获取标签信息 :return: """ if not self.tag: return {} return model_to_dict(self.tag, self.NORMAL_FIELD)
def get_classroom_info(self): """ 获取教室信息 :return: """ if not self.classroom: return {} return model_to_dict(self.classroom, self.NORMAL_FIELDS)
def get_template_info(self): """ 获取报名表信息 :return: """ if self.template is None: return return model_to_dict(self.template, self.FIELD)
def get_course_info(self): """ 获取课程信息 :return: """ if not self.course: return {} return model_to_dict(self.course, self.NORMAL_FIELDS)
def get_school_info(self): """ 获取学校信息 :return: """ if not self.school: return {} return model_to_dict(self.school, self.NORMAL_FIELDS)
def get_account_curriculum_info(self): """ 获取用户课表信息 :return: """ if self.account_curriculum is None: self.account_curriculum = self.get_account_curriculum() if self.account_curriculum is None: return None return model_to_dict(self.account_curriculum, self.ACCOUNT_FIELD)
def get_account_info(self): """ 获取用户信息 :return: """ if not self.account: return {} info = model_to_dict(self.account, self.NORMAL_FIELDS) info['avator'] = FireHydrantLocalStorage.generate_token(info['avator'], self.auth.get_account().id) return info
def get_association_info(self): """ 获取协会信息 :return: """ # 普通用户 field = self.NORMAL_FIELDS # 部长以上权限 if self.account and self.inspect(AssociationPermissionEnum.ASSOCIATION_VIEW_DATA): field = field + self.ADVANCED_FIELDS return model_to_dict(self.association, field)
def test_tent(self): """ 评价测试 :return: """ sc = PracticeEvaluateStudentToCourse.objects.create( author=self.student, star=4, message='课程很好我很喜欢', course=self.course) print(json.dumps(model_to_dict(sc, self.FIELD), indent=1)) sc.delete()
def get_attendance_info(self): """ 获取考勤表信息 :return: """ _time = time.time() info = model_to_dict(self.attendance, self.NOMAL_FILE) # 记录状态 status = 1 if _time > info.get('end_time', 0): status = 0 elif _time < info.get('start_time', 0): status = -1 info['status'] = status return info
def get_report_info(self): """ 获取汇报详情 :return: """ if self.report is None: return {} info = model_to_dict(self.report, self.NORMAL_FILE) info['resource'] = [{ 'name': i.name, 'size': i.size, 'create_time': i.create_time, 'token': ResourceLogic.get_download_token(i.hash) } for i in self.report.resource.all()] return info
def get_record_info(self): """ 获取记录信息 :return: """ if not self.record: return {} token = [] info = model_to_dict(self.record, self.NORMAL_FIELDS) entity = FaceURecordEntity() entity.update(info['result']) for i in entity.storage: token.append(FireHydrantLocalStorage.generate_token(i)) entity.storage = token info['result'] = entity.dump() return info
def get_classification_info(self): """ 获取分类信息 :return: """ if self.redis is None: self.redis = ClassificationRedisClusterFactory() if self.redis.exists(str(self.classification.id)): return self.redis.get_json(str(self.classification.id)) info = model_to_dict(self.classification, self.NORMAL_FILE) info['children'] = [{ 'id': c.id, 'name': c.name, 'description': c.description } for c in TaskClassification.objects.filter(parent_id=info.get('id', -1))] self.redis.set_json(str(self.classification.id), info) return info
def get_exhibition_info(self): """ 获取作品展示信息 :return: """ if self.exhibition is None: return dict() data = model_to_dict(self.exhibition, self.NORMAL_FILED) data['resource'] = [{ 'name': meta.name, 'size': meta.size, 'create_time': meta.create_time, 'token': ResourceLogic.get_download_token(meta.hash) } for meta in self.exhibition.resource.all()] return data
def get_account_info(self): """ 获取账户信息 :return: """ if self.account is None: return dict() info = model_to_dict(self.account, self.NORMAL_FIELD) account_team = AccountTeam.objects.filter(account=self.account) if account_team.exists(): team = account_team[0].team info['team'] = { 'nickname': team.nickname, 'id': team.id, 'role': account_team[0].role, 'create_time': account_team[0].create_time } else: info['team'] = None # 获取头像资源下载token from common.core.dao.storage.local import FireHydrantLocalStorage info['avator'] = FireHydrantLocalStorage.generate_token( info['avator'], self.account.id) return info
def get_task_info(self): """ 获取任务表信息 :return: """ return model_to_dict(self.task, self.TASK_FIELD)
def get_apply_info(self): """ 获取申请表信息 :return: """ return model_to_dict(self.apply, self.NORMAL_FIELD)
def get_task_info(self): """ 获取任务信息 :return: """ return model_to_dict(self.task, self.NORMAL_FIELD)
def get_school_info(self): """ 获取学习信息 :return: """ return model_to_dict(self.school, self.NORMAL_FIELDS)
def get_account_info(self): """ 获取账户信息 :return: """ return model_to_dict(self.account, self.NORMAL_FILES)