本文整理汇总了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}))
示例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')