Beispiel #1
0
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
Beispiel #2
0
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
Beispiel #3
0
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
Beispiel #4
0
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
Beispiel #5
0
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
Beispiel #6
0
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
Beispiel #7
0
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
Beispiel #8
0
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)