本文整理汇总了Python中course.Course.get方法的典型用法代码示例。如果您正苦于以下问题:Python Course.get方法的具体用法?Python Course.get怎么用?Python Course.get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类course.Course
的用法示例。
在下文中一共展示了Course.get方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get
# 需要导入模块: from course import Course [as 别名]
# 或者: from course.Course import get [as 别名]
def get(self):
user = self.get_current_student()
if not user:
self.redirect('/')
return
key = db.Key(encoded=self.request.get('course'))
course = Course.get(key)
chapters = []
chapter_keys = []
for q in course.chapters:
chapter = Chapter.get(q)
if chapter:
chapters.append(chapter)
chapter_keys.append(str(chapter.key()))
goto = self.request.get("goto")
if goto == None or goto == '':
goto = '/'
template_values = {'course': course,
'chapters': chapters,
'chapter_keys': chapter_keys,
'goto': goto,
}
write_template(self, user, 'student_course.html', template_values)
示例2: get
# 需要导入模块: from course import Course [as 别名]
# 或者: from course.Course import get [as 别名]
def get(self):
user = self.get_current_user()
if not user:
self.redirect("/")
return
key = db.Key(encoded=self.request.get("key"))
course = Course.get(key)
class_key = db.Key(encoded=self.request.get("class"))
goto = self.request.get("goto")
if goto == None or goto == "":
goto = "/"
# if class is different copy list to the new class
if class_key != course.parent_key():
aclass = Class.get(class_key)
newCourse = Course(parent=aclass)
newCourse.name = course.name
newCourse.chapters = course.chapters
newCourse.count_questions()
newCourse.put()
self.stop_edit_course()
self.redirect(goto)