本文整理匯總了Python中enroll.models.Course.season_key方法的典型用法代碼示例。如果您正苦於以下問題:Python Course.season_key方法的具體用法?Python Course.season_key怎麽用?Python Course.season_key使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類enroll.models.Course
的用法示例。
在下文中一共展示了Course.season_key方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: create
# 需要導入模塊: from enroll.models import Course [as 別名]
# 或者: from enroll.models.Course import season_key [as 別名]
def create(request):
course = Course()
season = None
folder = None
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 not ((folder is None) or (Season is None)):
course.folder_key = cfkey
course.season_key = cskey
if request.method == "POST":
form = CourseForm(request.POST, instance=course)
if form.is_valid():
logging.info("edit course before %s" % course)
form.save(commit=False)
logging.info("edit course after %s" % course)
course.mark_as_modify()
course.save()
cdbsync.plan_cdb_put(course)
return HttpResponseRedirect("..")
else:
form = CourseForm(instance=course)
return render_to_response("admin/courses_create.html", RequestContext(request, {"form": form}))