本文整理汇总了Python中enroll.models.Course.folder_key方法的典型用法代码示例。如果您正苦于以下问题:Python Course.folder_key方法的具体用法?Python Course.folder_key怎么用?Python Course.folder_key使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类enroll.models.Course
的用法示例。
在下文中一共展示了Course.folder_key方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: create
# 需要导入模块: from enroll.models import Course [as 别名]
# 或者: from enroll.models.Course import folder_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}))