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


Python Course.list_season方法代碼示例

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


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

示例1: index

# 需要導入模塊: from enroll.models import Course [as 別名]
# 或者: from enroll.models.Course import list_season [as 別名]
def index(request):

    season = None
    if request.method == 'POST':
        filter_form = SeasonFilterForm(request.POST)
        if filter_form.is_valid():
            season = Season.get(str(filter_form.cleaned_data['season_key']))
            if not season is None:
                request.session['backup_season_key']=str(season.key())
    else:
        bskey = request.session.get('backup_season_key',None)
        if not bskey is None:
            season =  Season.get(str(bskey))
        if season is None:
            filter_form = SeasonFilterForm()
        else:
            filter_form = SeasonFilterForm({'season_key':str(season.key())})



    if season is None:
        course_list = None
    else:
        course_list = Course.list_season(str(season.key())) 

    return render_to_response('admin/backup_index.html', RequestContext(request, { 'filter_form':filter_form, 'course_list': course_list}))
開發者ID:prcek,項目名稱:TSReg,代碼行數:28,代碼來源:backup_views.py

示例2: update_all_students_for_season

# 需要導入模塊: from enroll.models import Course [as 別名]
# 或者: from enroll.models.Course import list_season [as 別名]
def update_all_students_for_season(request):
    logging.info("update_all_students_for_season")
    logging.info(request.POST)
    season_id = request.POST['season_id']
    season = Season.get_by_id(int(season_id))
    if season is None:
        raise Http404 
    logging.info("season %s" % season)
    cdbsync.plan_cdb_put(season)
    courses = Course.list_season(str(season.key()))
    logging.info("all courses get") 
    for c in courses:
        logging.info("course %s "%c.key())
        taskqueue.add(url='/task/update_all_students_for_course/', params={'course_id':c.key().id()})
    return HttpResponse('ok')
開發者ID:,項目名稱:,代碼行數:17,代碼來源:


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