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


Python Course.list方法代碼示例

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


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

示例1: plan_update_all_courses

# 需要導入模塊: from enroll.models import Course [as 別名]
# 或者: from enroll.models.Course import list [as 別名]
def plan_update_all_courses(request):
    logging.info("update_all_courses")
    courses = Course.list()
    for c in courses:
        logging.info("course %s"%c.key())
        cdbsync.plan_cdb_put(c)
    return HttpResponse('ok')
開發者ID:prcek,項目名稱:TSReg,代碼行數:9,代碼來源:test_views.py

示例2: all_courses

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

########## hromadne vypnuti slevy
    course_list=Course.list()
    for c in course_list: 
        if c.cost_sale:
            logging.info('course %s sale off'%(c.code))
            c.cost_sale = False
            c.save()
#############

    return HttpResponse('ok')    
開發者ID:prcek,項目名稱:TSReg,代碼行數:14,代碼來源:sys_views.py

示例3: index

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

    course_list = None
    season = None
    folder = None
    if request.method == "POST":
        form = SeasonCategoryFilterForm(request.POST)
        if form.is_valid():
            season = Season.get(str(form.cleaned_data["season_key"]))
            folder = Folder.get(str(form.cleaned_data["folder_key"]))
            if not season is None:
                request.session["course_season_key"] = str(season.key())
            if not folder is None:
                request.session["course_folder_key"] = str(folder.key())
    else:
        cskey = request.session.get("course_season_key", None)
        if not cskey is None:
            season = Season.get(str(cskey))
        cfkey = request.session.get("course_folder_key", None)
        if not cfkey is None:
            folder = Folder.get(str(cfkey))

        if (season is None) or (folder is None):
            form = SeasonCategoryFilterForm()
        else:
            form = SeasonCategoryFilterForm({"season_key": str(season.key()), "folder_key": str(folder.key())})

    if (season is None) or (folder is None):
        course_list = None
        if request.GET.get("all", None):
            logging.info("all mode")
            course_list = Course.list()

    else:
        if request.GET.get("all", None):
            logging.info("all mode")
            course_list = Course.list()
        else:
            course_list = Course.list_filter(str(season.key()), str(folder.key()))

    tc_em = 0
    tc_ef = 0
    tc_e = 0
    tc_pm = 0
    tc_pf = 0
    tc_p = 0

    tc_ppm = 0
    tc_ppf = 0
    tc_pp = 0

    tc_npm = 0
    tc_npf = 0
    tc_np = 0

    tc_sum = 0
    if course_list is not None:
        for c in course_list:
            tc_em += c.stat_e_m
            tc_ef += c.stat_e_f
            tc_e += c.usage
            tc_pm += c.stat_fp_m
            tc_pf += c.stat_fp_f
            tc_p += c.stat_fp_m + c.stat_fp_f
            tc_ppm += c.stat_pp_m
            tc_ppf += c.stat_pp_f
            tc_pp += c.stat_pp_m + c.stat_pp_f
            tc_npm += c.stat_np_m
            tc_npf += c.stat_np_f
            tc_np += c.stat_np_m + c.stat_np_f
            tc_sum += c.stat_paid

    return render_to_response(
        "admin/courses_index.html",
        RequestContext(
            request,
            {
                "form": form,
                "course_list": course_list,
                "tc_em": tc_em,
                "tc_ef": tc_ef,
                "tc_e": tc_e,
                "tc_pm": tc_pm,
                "tc_pf": tc_pf,
                "tc_p": tc_p,
                "tc_ppm": tc_ppm,
                "tc_ppf": tc_ppf,
                "tc_pp": tc_pp,
                "tc_npm": tc_npm,
                "tc_npf": tc_npf,
                "tc_np": tc_np,
                "tc_sum": tc_sum,
            },
        ),
    )
開發者ID:prcek,項目名稱:TSReg,代碼行數:97,代碼來源:course_views.py


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