def rm_label(tid, name): teams = team.get(tid) if teams.count() < 1: return ACC_NO_FOUND elif team.rm_team_label(teams.first(), name): return TEAM_OK else: return LABEL_NO_FOUND
def add_stu(tid, sid): teams = team.get(tid) if teams.count() < 1: return ACC_NO_FOUND stus = query(sid) if stus.count() < 1: return STU_NO_FOUND team.add_stu(teams.first(), stus.first()) return TEAM_OK
def rm_photo(tid, img_id): teams = team.get(tid) if teams.count() < 1: return ACC_NO_FOUND imgs = TeamImg.objects.filter(id=img_id) if imgs.count() < 1: return ACC_NO_FOUND imgs.delete() return TEAM_OK
def update_contact(tid, tel, mail): teams = team.get(tid) pwds = team.acc(tid) if teams.count() < 1: return ACC_NO_FOUND if pwds.count() < 1: return ACC_NO_FOUND pwds.update(mail=mail) teams.update(contact_tel=tel) return TEAM_OK
def rm_stu(tid, sid): teams = team.get(tid) if teams.count() < 1: return ACC_NO_FOUND stus = query(sid) if stus.count() < 1: return STU_NO_FOUND if team.rm_team_stu(teams.first(), stus.first()): return TEAM_OK else: return STU_NO_FOUND
def update_info(tid, name, logo_path, slogan, about, history, b_type): teams = team.get(tid) if teams.count() < 1: return ACC_NO_FOUND else: teams.update(name=name, logo_path=logo_path, slogan=slogan, about=about, history=history, b_type=b_type) return TEAM_OK
def save_photo(tid, name, img): teams = team.get(tid) if teams.count() < 1: return ACC_NO_FOUND img_count = team.img_cnt() name = str(time.time()).replace('.', '').replace( ' ', '') + str(img_count) + name name = name.replace(' ', '') path = name2path(name) save(img, path) img_id = team.add_img(teams.first(), path) return img_id, path
def add_label(tid, name): teams = team.get(tid) if teams.count() < 1: return ACC_NO_FOUND else: return team.add_team_label(teams.first(), name)