當前位置: 首頁>>代碼示例>>Python>>正文


Python Course.select_courses方法代碼示例

本文整理匯總了Python中course.Course.select_courses方法的典型用法代碼示例。如果您正苦於以下問題:Python Course.select_courses方法的具體用法?Python Course.select_courses怎麽用?Python Course.select_courses使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在course.Course的用法示例。


在下文中一共展示了Course.select_courses方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test

# 需要導入模塊: from course import Course [as 別名]
# 或者: from course.Course import select_courses [as 別名]
def test():

    reqargs = request.args.getlist('clsl')

    department_string = request.args.get('dep')
    course_name_filter_string = request.args.get('cnf')
    prof_name_filter_string = request.args.get('pnf')
    course_day_filter_string = request.args.get('cdf')
    course_time_filter_string = request.args.get('ctf')
    sex_filter_int = (request.args.get('jens') and int(request.args.get('jens'))) or 0

    dep_filter = department_filter(department_string)
    course_name_filter = parse_courfilter_string(course_name_filter_string)
    prof_name_filter = parse_proffilter_string(prof_name_filter_string)
    course_day_filter = parse_dayfilter_string(course_day_filter_string)
    course_time_filter = parse_timefilter_string(course_time_filter_string)
    sex_filt = sex_filter(sex_filter_int)

    final_filter = and_filter(course_name_filter,
                              prof_name_filter,
                              course_day_filter,
                              course_time_filter,
                              dep_filter,
                              sex_filt)

    selected_courses = Course.select_courses(courses, reqargs)
    user = ''
    if 'username' in session:
        user = session['username']
    if selected_courses:
        selected_user_courses[user] = selected_courses
    unselected_courses = [
        cour for cour in courses if not cour in selected_courses]
    return render_template('main_template.html',
                           selected_courses=selected_courses,
                           unselected_courses=filter(
                               final_filter, unselected_courses),
                           user=user,
                           filter_strings=[course_name_filter_string,
                                           prof_name_filter_string,
                                           course_day_filter_string,
                                           course_time_filter_string,
                                           department_string,
                                           sex_filter_int],
                           departments=departments)
開發者ID:ahrm,項目名稱:less-mess-sess,代碼行數:47,代碼來源:mainapp.py

示例2: schedule

# 需要導入模塊: from course import Course [as 別名]
# 或者: from course.Course import select_courses [as 別名]
def schedule():
    reqargs = request.args.getlist('clsl')
    selected_courses = Course.select_courses(courses, reqargs)
    return render_template('schedule.html', selected_courses=selected_courses)
開發者ID:ahrm,項目名稱:less-mess-sess,代碼行數:6,代碼來源:mainapp.py


注:本文中的course.Course.select_courses方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。