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