本文整理匯總了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')