当前位置: 首页>>代码示例>>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;未经允许,请勿转载。