def ensureTaskProgressExist(cls, **args): return ViewUtils.ensureObjectExist(TaskProgress, ErrorType.ProgressReqNotExist, **args)
def ensureTaskExist(cls, **args): return ViewUtils.ensureObjectExist(Task, ErrorType.TaskNotExist, **args)
def ensureTaskTakeExist(cls, tid, uid): return ViewUtils.ensureObjectExist(TaskTake, ErrorType.TaskTakeNotExist, task_id=tid, user_id=uid)
def ensureUserExist(cls, **args): return ViewUtils.ensureObjectExist( User, ErrorType.UsernameExist, **args)
def ensureFriendExist(cls, **args): return ViewUtils.ensureObjectExist( Friend, ErrorType.NotAFriend, **args)
def ensureNoticeExist(cls, **args): return ViewUtils.ensureObjectExist( Notice, ErrorType.NoticeNotExist, **args)
def ensureParticipationExist(cls, uid, pid): return ViewUtils.ensureObjectExist( Participation, ErrorType.DoNotParticipated, user_id=uid, project_id=pid)
def ensureProjectManager(cls, uid, pid): part = cls.getParticipation(uid, pid) part_roles = part.participationrole_set.all() ViewUtils.ensureObjectExist( ParticipationRole, ErrorType.NotAProjManager, part_roles, role_id=Role.ProjectManagerId)
def ensureRoleExist(cls, rid): return ViewUtils.ensureObjectExist( Role, ErrorType.RoleNotExist, id=rid)
def ensureProjectExist(cls, **args): return ViewUtils.ensureObjectExist( Project, ErrorType.ProjectNotExist, **args)