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