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')
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')
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, }, ), )