def course_drop(CourseNum): if isinstance(current_user._get_current_object(), Student): Courses = current_user.Courses course_selected = [Course_.CourseNum for Course_ in Courses] if not CourseNum in course_selected: flash('您未选择该门课程!') else: current_user.drop_course(CourseNum) db.session.commit() flash('您已成功退选该门课程。') return redirect(url_for('course_select_table'))
def course_change(CourseNum): if isinstance(current_user._get_current_object(), Student): current_user.drop_course(CourseNum) db.session.commit() return redirect(url_for('course_teachers', CourseNum=CourseNum))