Example #1
0
def creat_course():
    print('创建课程')
    while True:
        # 创建课程之前先选择学校
        school_name_list = school_interface.check_all_school()
        if not school_name_list:
            print('学校为空,创建课程前请先创建学校')
            return
        for i, school in enumerate(school_name_list):
            print('%s schoolName:%s' % (i, school))
        choose = input('请先选择校区(输入数字)>>:')
        if choose == 'q': break
        if choose.isdigit():
            choose = int(choose)
            if choose >= 0 and choose < len(school_name_list):
                course_name = input('please input course name>>:').strip()
                flag, msg = admin_interface.creat_course(
                    admin_info['name'], school_name_list[choose], course_name)
                if flag:
                    print(msg)
                    break
                else:
                    print(msg)
            else:
                print('请输入存在的校区')
        else:
            print('must input number')
def choose_school():
    print('选择校区')
    while True:
        # 循环打印校区
        school_name_list = school_interface.check_all_school()
        if not school_name_list:
            print('暂无校区,请联系管理员创建校区')
            return
        for i, school in enumerate(school_name_list):
            print('%s schoolName:%s' % (i, school))
        choose = input('请先选择校区(输入数字)>>:')
        if choose == 'q': break
        if choose.isdigit():
            choose = int(choose)
            if choose >= 0 and choose < len(school_name_list):
                flag, msg = student_interface.choose_school(
                    student_info['name'], school_name_list[choose])
                if flag:
                    print(msg)
                    break
                else:
                    print(msg)
                    break
            else:
                print('请选择存在的学校')
        else:
            print('请输入数字')
def choice_school():
    while 1:
        res = school_interface.check_all_school()
        print(res)
        choice_s = input('请输入要去的学校:>>').strip()
        if choice_s == 'q': break
        if choice_s not in res: continue
        flag, msg = school_interface.add_student(user_info['name'], choice_s)
        if flag:
            print(msg)
            break
def create_teacher():
    while 1:
        t_name = input('请输入要老师名字:>>').strip()
        if t_name == 'q': break
        res = school_interface.check_all_school()
        print(res)
        t_school = input('请输入学校:>>').strip()
        if t_school == 'q': break
        if t_school not in res: continue
        print(school_interface.add_teacher(t_name, t_school))
        flag, msg = teacher_interface.save_teacher(model.Teacher(t_name))
        if flag:
            print(msg)
            break