本文整理汇总了Python中models.models.StudentProfileDAO类的典型用法代码示例。如果您正苦于以下问题:Python StudentProfileDAO类的具体用法?Python StudentProfileDAO怎么用?Python StudentProfileDAO使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了StudentProfileDAO类的17个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: get
def get(self):
"""Handles GET requests."""
models.MemcacheManager.begin_readonly()
try:
user = self.personalize_page_and_get_user()
if user is None:
student = TRANSIENT_STUDENT
else:
student = Student.get_enrolled_student_by_user(user)
profile = StudentProfileDAO.get_profile_by_user(user)
self.template_value['has_global_profile'] = profile is not None
if not student:
student = TRANSIENT_STUDENT
if (student.is_transient and
not self.app_context.get_environ()['course']['browsable']):
self.redirect('/preview')
return
# If we are on this page due to visiting the course base URL
# (and not base url plus "/course"), redirect registered students
# to the last page they were looking at.
last_location = self.get_redirect_location(student)
if last_location:
self.redirect(last_location)
return
tracker = self.get_progress_tracker()
units = self.get_track_matching_student(student)
units = filter_assessments_used_within_units(units)
self.template_value['units'] = units
self.template_value['show_registration_page'] = True
if student and not student.is_transient:
augment_assessment_units(self.get_course(), student)
self.template_value['course_progress'] = (
tracker.get_course_progress(student))
elif user:
profile = StudentProfileDAO.get_profile_by_user_id(
user.user_id())
additional_registration_fields = self.app_context.get_environ(
)['reg_form']['additional_registration_fields']
if profile is not None and not additional_registration_fields:
self.template_value['show_registration_page'] = False
self.template_value['register_xsrf_token'] = (
XsrfTokenManager.create_xsrf_token('register-post'))
self.template_value['transient_student'] = student.is_transient
self.template_value['progress'] = tracker.get_unit_progress(student)
course = self.app_context.get_environ()['course']
set_image_or_video_exists(self.template_value, course)
self.template_value['is_progress_recorded'] = is_progress_recorded(
self, student)
self.template_value['navbar'] = {'course': True}
finally:
models.MemcacheManager.end_readonly()
self.render('course.html')
开发者ID:danieldalonzo,项目名称:coursebuilder-core,代码行数:58,代码来源:lessons.py
示例2: post
def post(self):
"""Handles POST requests."""
user = self.personalize_page_and_get_user()
if not user:
self.redirect(users.create_login_url(self.request.uri), normalize=False)
return
if not self.assert_xsrf_token_or_fail(self.request, "register-post"):
return
can_register = self.app_context.get_environ()["reg_form"]["can_register"]
if not can_register:
self.redirect("/course#registration_closed")
return
if "name_from_profile" in self.request.POST.keys():
profile = StudentProfileDAO.get_profile_by_user_id(user.user_id())
name = profile.nick_name
else:
name = self.request.get("form01")
Student.add_new_student_for_current_user(name, transforms.dumps(self.request.POST.items()))
course = sites.get_course_for_current_request()
if course.get_slug().split("_")[-1] == "DFR":
self.redirect("/gDefier/register")
else:
self.redirect("/course#registration_confirmation")
开发者ID:diego-G,项目名称:gdefier,代码行数:28,代码来源:utils.py
示例3: get
def get(self):
"""Handles GET request."""
user = self.personalize_page_and_get_user()
if not user:
self.redirect(
users.create_login_url(self.request.uri), normalize=False)
return
student = Student.get_enrolled_student_by_email(user.email())
if student:
self.redirect('/course')
return
can_register = self.app_context.get_environ(
)['reg_form']['can_register']
if not can_register:
self.redirect('/course#registration_closed')
return
# pre-fill nick name from the profile if available
self.template_value['current_name'] = ''
profile = StudentProfileDAO.get_profile_by_user_id(user.user_id())
if profile and profile.nick_name:
self.template_value['current_name'] = profile.nick_name
self.template_value['navbar'] = {}
self.template_value['transient_student'] = True
self.template_value['register_xsrf_token'] = (
XsrfTokenManager.create_xsrf_token('register-post'))
self.render('register.html')
开发者ID:joseespino,项目名称:Google-Course-Builder-1.6.0-Modified-,代码行数:31,代码来源:utils.py
示例4: get
def get(self):
"""Handles GET request."""
user = self.personalize_page_and_get_user()
if not user:
self.redirect(users.create_login_url(self.request.uri), normalize=False)
return
student = Student.get_enrolled_student_by_user(user)
if student:
self.redirect("/course")
return
can_register = self.app_context.get_environ()["reg_form"]["can_register"]
if not can_register:
self.redirect("/course#registration_closed")
return
# pre-fill nick name from the profile if available
self.template_value["current_name"] = ""
profile = StudentProfileDAO.get_profile_by_user_id(user.user_id())
if profile and profile.nick_name:
self.template_value["current_name"] = profile.nick_name
self.template_value["navbar"] = {}
self.template_value["transient_student"] = True
self.template_value["register_xsrf_token"] = XsrfTokenManager.create_xsrf_token("register-post")
alternate_content = []
for hook in self.PREVENT_REGISTRATION_HOOKS:
alternate_content.extend(hook(self.app_context, user.user_id()))
self.template_value["alternate_content"] = alternate_content
self.render("register.html")
开发者ID:manniru,项目名称:course-builder,代码行数:33,代码来源:utils.py
示例5: post
def post(self):
"""Handles POST requests."""
user = self.personalize_page_and_get_user()
if not user:
self.redirect(
users.create_login_url(self.request.uri), normalize=False)
return
if not self.assert_xsrf_token_or_fail(self.request, 'register-post'):
return
can_register = self.app_context.get_environ(
)['reg_form']['can_register']
if not can_register:
self.redirect('/course#registration_closed')
return
if 'name_from_profile' in self.request.POST.keys():
profile = StudentProfileDAO.get_profile_by_user_id(user.user_id())
name = profile.nick_name
else:
name = self.request.get('form01')
Student.add_new_student_for_current_user(
name, transforms.dumps(self.request.POST.items()))
# Render registration confirmation page
self.redirect('/course#registration_confirmation')
开发者ID:joseespino,项目名称:Google-Course-Builder-1.6.0-Modified-,代码行数:27,代码来源:utils.py
示例6: get
def get(self):
"""Handles GET requests."""
if not course_explorer.GCB_ENABLE_COURSE_EXPLORER_PAGE.value:
self.error(404)
return
user = self.initialize_page_and_get_user()
if not user:
self.redirect('/explorer')
return
courses = self.get_public_courses()
self.template_values['student'] = (
StudentProfileDAO.get_profile_by_user_id(user.user_id()))
self.template_values['navbar'] = {'profile': True}
self.template_values['courses'] = self.get_enrolled_courses(courses)
self.template_values['student_edit_xsrf_token'] = (
XsrfTokenManager.create_xsrf_token(
STUDENT_RENAME_GLOBAL_XSRF_TOKEN_ID))
self.template_values['html_hooks'] = NullHtmlHooks()
self.template_values['student_preferences'] = {}
template = jinja_utils.get_template(
'/modules/course_explorer/views/profile.html', DIR)
self.response.write(template.render(self.template_values))
开发者ID:CSCI1200Course,项目名称:csci1200OnlineCourse,代码行数:25,代码来源:student.py
示例7: initialize
def initialize(cls, template_values):
template_values.update(
{'show_course_explorer_tab': GCB_ENABLE_COURSE_EXPLORER_PAGE.value})
user = users.get_current_user()
if user:
profile = StudentProfileDAO.get_profile_by_user_id(
users.get_current_user().user_id())
template_values.update({'has_global_profile': profile is not None})
开发者ID:FilterKaapi,项目名称:course-builder,代码行数:8,代码来源:course_explorer.py
示例8: get
def get(self):
"""Handles GET requests."""
user = self.personalize_page_and_get_user()
if user is None:
student = TRANSIENT_STUDENT
else:
student = Student.get_enrolled_student_by_email(user.email())
profile = StudentProfileDAO.get_profile_by_user_id(user.user_id())
self.template_value["has_global_profile"] = profile is not None
if not student:
student = TRANSIENT_STUDENT
if student.is_transient and not self.app_context.get_environ()["course"]["browsable"]:
self.redirect("/preview")
return
self.template_value["units"] = self.get_units()
self.template_value["show_registration_page"] = True
if student and not student.is_transient:
self.augment_assessment_units(student)
elif user:
profile = StudentProfileDAO.get_profile_by_user_id(user.user_id())
additional_registration_fields = self.app_context.get_environ()["reg_form"][
"additional_registration_fields"
]
if profile is not None and not additional_registration_fields:
self.template_value["show_registration_page"] = False
self.template_value["register_xsrf_token"] = XsrfTokenManager.create_xsrf_token("register-post")
self.template_value["transient_student"] = student.is_transient
self.template_value["progress"] = self.get_progress_tracker().get_unit_progress(student)
course = self.app_context.get_environ()["course"]
self.template_value["video_exists"] = bool(
"main_video" in course and "url" in course["main_video"] and course["main_video"]["url"]
)
self.template_value["image_exists"] = bool(
"main_image" in course and "url" in course["main_image"] and course["main_image"]["url"]
)
self.template_value["is_progress_recorded"] = CAN_PERSIST_ACTIVITY_EVENTS.value
self.template_value["navbar"] = {"course": True}
self.render("course.html")
开发者ID:johnfelipe,项目名称:cb-energietransitie,代码行数:44,代码来源:lessons.py
示例9: post
def post(self):
"""Handles POST requests."""
user = self.personalize_page_and_get_user()
if not user:
self.redirect(
users.create_login_url(self.request.uri), normalize=False)
return
if not self.assert_xsrf_token_or_fail(self.request, 'register-post'):
return
can_register = self.app_context.get_environ(
)['reg_form']['can_register']
if not can_register:
self.redirect('/course#registration_closed')
return
if 'name_from_profile' in self.request.POST.keys():
profile = StudentProfileDAO.get_profile_by_user_id(user.user_id())
name = profile.nick_name
else:
name = self.request.get('form01')
Student.add_new_student_for_current_user(
name, transforms.dumps(self.request.POST.items()))
# CGL-MOOC-Builder: Get user's Google App email and
# course title, email body from course setting page.
course = self.app_context.get_environ()['course']
if 'google_app_email' in course:
sender_email = course['google_app_email']
else:
sender_email = ''
if 'title' in course:
course_title = course['title']
else:
course_title = ''
if 'email_body' in course and course['email_body'] != '':
email_body = course['email_body']
else:
email_body = "<div style='background-color: #999999; color: #ffffff; padding: 0px 20px 20px 20px; font-family: 'Verdana', sans-serif;'> <div style='width: 500px; margin: 0 auto;'> <p style='background-color: #093359; height: 100px; margin: 0px; padding: 0px;'> <img src='http://cloudmooc.pti.indiana.edu:8080/assets/img/Logo.png'></img> </p> <div style='background-color: #CCC; color: black; padding: 15px;'> <p>Welcome " + name + ",</p> <p>Thank you for enrolling in this.</p> </div> <p style='background-color: #012256; height: 50px; margin: 0px; padding: 0px;'></p></div></div>"
# CGL-MOOC-Builder starts:
# Send an notification email after registration
sender_address = course_title + " <"+sender_email+">"
user_address = name + " <" + user.email() + ">"
subject = "Welcome "+name+" to "+course_title
body = "Welcome!"
html = email_body
mail.send_mail(sender_address, user_address, subject, body, html=html)
# CGL-MOOC-Builder ends
# Render registration confirmation page
self.redirect('/course#registration_confirmation')
开发者ID:cglmoocs,项目名称:cgl-mooc-builder,代码行数:56,代码来源:utils.py
示例10: post
def post(self):
"""Handles post requests."""
if not self.is_valid_xsrf_token(STUDENT_RENAME_GLOBAL_XSRF_TOKEN_ID):
self.error(403)
return
user = self.initialize_page_and_get_user()
if not user:
self.redirect('/explorer')
return
new_name = self.request.get('name')
if not (new_name and self._storable_in_string_property(new_name)):
self.error(400)
return
StudentProfileDAO.update(
user.user_id(), None, nick_name=new_name, profile_only=True)
self.redirect('/explorer/profile')
开发者ID:CSCI1200Course,项目名称:csci1200OnlineCourse,代码行数:19,代码来源:student.py
示例11: get
def get(self):
"""Handles GET requests."""
user = self.personalize_page_and_get_user()
if user is None:
student = TRANSIENT_STUDENT
else:
student = Student.get_enrolled_student_by_email(user.email())
if not student:
student = TRANSIENT_STUDENT
# If the course is browsable, or the student is logged in and
# registered, redirect to the main course page.
if ((student and not student.is_transient) or
self.app_context.get_environ()['course']['browsable']):
self.redirect('/course')
return
units = self.get_units()
self.template_value['transient_student'] = True
self.template_value['can_register'] = self.app_context.get_environ(
)['reg_form']['can_register']
self.template_value['navbar'] = {'course': True}
self.template_value['units'] = units
self.template_value['show_registration_page'] = True
course = self.app_context.get_environ()['course']
self.template_value['video_exists'] = bool(
'main_video' in course and
'url' in course['main_video'] and
course['main_video']['url'])
self.template_value['image_exists'] = bool(
'main_image' in course and
'url' in course['main_image'] and
course['main_image']['url'])
#get all lessons info
all_lessons = {}
for u in units:
if u.type == 'U':
all_lessons[u.unit_id] = get_all_lesson(self, u.unit_id)
self.template_value['all_lessons'] = all_lessons
if user:
profile = StudentProfileDAO.get_profile_by_user_id(user.user_id())
additional_registration_fields = self.app_context.get_environ(
)['reg_form']['additional_registration_fields']
if profile is not None and not additional_registration_fields:
self.template_value['show_registration_page'] = False
self.template_value['register_xsrf_token'] = (
XsrfTokenManager.create_xsrf_token('register-post'))
self.render('preview.html')
开发者ID:sidds1601,项目名称:BigDataMOOC,代码行数:50,代码来源:utils.py
示例12: get
def get(self):
"""Handles GET requests."""
user = self.initialize_page_and_get_user()
courses = self.get_public_courses()
self.template_values['student'] = (
StudentProfileDAO.get_profile_by_user_id(user.user_id()))
self.template_values['navbar'] = {'profile': True}
self.template_values['courses'] = self.get_enrolled_courses(courses)
self.template_values['student_edit_xsrf_token'] = (
XsrfTokenManager.create_xsrf_token(
STUDENT_RENAME_GLOBAL_XSRF_TOKEN_ID))
template = jinja_utils.get_template(
'/modules/course_explorer/views/profile.html', DIR, LOCALE)
self.response.write(template.render(self.template_values))
开发者ID:Domofera,项目名称:Domofera_MOOC,代码行数:15,代码来源:student.py
示例13: post
def post(self):
"""Handles POST requests."""
user = self.personalize_page_and_get_user()
if not user:
self.redirect(
users.create_login_url(self.request.uri), normalize=False)
return
if not self.assert_xsrf_token_or_fail(self.request, 'register-post'):
return
can_register = self.app_context.get_environ(
)['reg_form']['can_register']
if not can_register:
self.redirect('/course#registration_closed')
return
if 'name_from_profile' in self.request.POST.keys():
profile = StudentProfileDAO.get_profile_by_user_id(user.user_id())
name = profile.nick_name
else:
name = self.request.get('form01')
age = self.request.get('age') #Age
city = self.request.get('city') #City
state = self.request.get('state') #State
country = self.request.get('country') #Country
education = self.request.get('education') #Education
profession = self.request.get('profession') #Profession
organization = self.request.get('organization') #Organization
motivation = self.request.get('motivation') #Motivation
privacy = self.request.get('privacy') #Privacy
reference = self.request.get('reference') #Reference
Student.add_new_student_for_current_user(
name, age, city, state, country, education, profession, organization, motivation, privacy, reference, transforms.dumps(self.request.POST.items()))
# send a notification email
sender_address = "X-Informatics <[email protected]>"
user_address = name + " <" + user.email() + ">"
subject = "Welcome to the Big Data Applications and Analytics MOOC"
body = "Dear " + name + ", Example HTML content"
html = "<div style='background-color: #999999; color: #ffffff; padding: 0px 20px 20px 20px; font-family: 'Verdana', sans-serif;'> <div style='width: 500px; margin: 0 auto;'> <p style='background-color: #093359; height: 100px; margin: 0px; padding: 0px;'> <img src='http://cloudmooc.pti.indiana.edu:8080/assets/img/Logo.png'></img> </p> <div style='background-color: #CCC; color: black; padding: 15px;'> <p>Welcome " + name + ",</p> <p>Thank you for enrolling in <a href='https://bigdatacourse.appspot.com' title='Big Data Applications and Analytics MOOC' target='_blank' style='color: #003366; '>Big Data Applications and Analytics MOOC</a>. This MOOC will take you on a journey to learn great things about Big Data and its case studies.</p> <p>This course is open for everyone, so watch a unit or two whenever you get time. You can also review homework assignments of your peers and view your feedback!</p><p>You can download the entire <a href='http://tinyurl.com/bigdatasyllabus' title='Big Data MOOC Course Syllabus' target='_blank'>syllabus</a>, <a href='https://www.dropbox.com/s/2p2zj9jbywcb76u/Course_Slides.pdf' title='Big Data MOOC Course Slides' target='_blank'>slides</a>, and the entire <a href='https://www.dropbox.com/s/htvr0l9d6g2gl71/Big_Data_Course_Material.zip' title='Big Data MOOC Course Material Zip File' target='_blank'>course material</a> directly.</p><p>Get Ready!<br> Geoffrey Fox and the Big Data MOOC Team</p> <p>Go to the <a href='https://bigdatacourse.appspot.com' title='Big Data Applications and Analytics MOOC' target='_blank' style='color: #093359;'>Course</a></p> <p>Share this MOOC with your friends!</p> </div> <p style='background-color: #012256; height: 50px; margin: 0px; padding: 0px;'></p></div></div>"
mail.send_mail(sender_address, user_address, subject, body, html=html)
# Render registration confirmation page
self.redirect('/course#registration_confirmation')
开发者ID:cglmoocs,项目名称:BigDataMOOC,代码行数:46,代码来源:utils.py
示例14: get
def get(self):
"""Handles GET requests."""
user = self.personalize_page_and_get_user()
if user is None:
student = TRANSIENT_STUDENT
else:
student = Student.get_enrolled_student_by_email(user.email())
if not student:
student = TRANSIENT_STUDENT
# If the course is browsable, or the student is logged in and
# registered, redirect to the main course page.
if (student and not student.is_transient) or self.app_context.get_environ()["course"]["browsable"]:
self.redirect("/course")
return
self.template_value["transient_student"] = True
self.template_value["can_register"] = self.app_context.get_environ()["reg_form"]["can_register"]
self.template_value["navbar"] = {"course": True}
self.template_value["units"] = self.get_units()
self.template_value["show_registration_page"] = True
course = self.app_context.get_environ()["course"]
self.template_value["video_exists"] = bool(
"main_video" in course and "url" in course["main_video"] and course["main_video"]["url"]
)
self.template_value["image_exists"] = bool(
"main_image" in course and "url" in course["main_image"] and course["main_image"]["url"]
)
if user:
profile = StudentProfileDAO.get_profile_by_user_id(user.user_id())
additional_registration_fields = self.app_context.get_environ()["reg_form"][
"additional_registration_fields"
]
if profile is not None and not additional_registration_fields:
self.template_value["show_registration_page"] = False
self.template_value["register_xsrf_token"] = XsrfTokenManager.create_xsrf_token("register-post")
self.render("preview.html")
开发者ID:diego-G,项目名称:gdefier,代码行数:39,代码来源:utils.py
示例15: initialize_student_state
def initialize_student_state(self):
"""Initialize course information related to student."""
PageInitializerService.get().initialize(self.template_values)
self.enrolled_courses_dict = {}
self.courses_progress_dict = {}
user = users.get_current_user()
if not user:
return
profile = StudentProfileDAO.get_profile_by_user_id(user.user_id())
if not profile:
return
self.template_values['register_xsrf_token'] = (
XsrfTokenManager.create_xsrf_token('register-post'))
self.enrolled_courses_dict = transforms.loads(profile.enrollment_info)
if self.enrolled_courses_dict:
self.template_values['has_enrolled_courses'] = True
if profile.course_info:
self.courses_progress_dict = transforms.loads(profile.course_info)
开发者ID:CSCI1200Course,项目名称:csci1200OnlineCourse,代码行数:22,代码来源:student.py
示例16: get
def get(self):
"""Handles GET requests."""
user = self.personalize_page_and_get_user()
if user is None:
student = TRANSIENT_STUDENT
else:
student = Student.get_enrolled_student_by_email(user.email())
profile = StudentProfileDAO.get_profile_by_user_id(user.user_id())
self.template_value['has_global_profile'] = profile is not None
if not student:
student = TRANSIENT_STUDENT
if (student.is_transient and
not self.app_context.get_environ()['course']['browsable']):
self.redirect('/preview')
return
# CGL-MOOC-Builder:
self.template_value['units'] = self.get_units()
self.template_value['sorted_units'] = self.get_units_groupby_section()
self.template_value['show_registration_page'] = True
if student and not student.is_transient:
self.augment_assessment_units(student)
elif user:
profile = StudentProfileDAO.get_profile_by_user_id(user.user_id())
additional_registration_fields = self.app_context.get_environ(
)['reg_form']['additional_registration_fields']
if profile is not None and not additional_registration_fields:
self.template_value['show_registration_page'] = False
self.template_value['register_xsrf_token'] = (
XsrfTokenManager.create_xsrf_token('register-post'))
self.template_value['transient_student'] = student.is_transient
self.template_value['progress'] = (
self.get_progress_tracker().get_unit_progress(student))
course = self.app_context.get_environ()['course']
self.template_value['video_exists'] = bool(
'main_video' in course and
'url' in course['main_video'] and
course['main_video']['url'])
self.template_value['image_exists'] = bool(
'main_image' in course and
'url' in course['main_image'] and
course['main_image']['url'])
# CGL-MOOC-Builder: Set template values for instructor_details and main_video
if 'instructor_details' in course:
self.template_value['instructor_details'] = course['instructor_details']
else:
self.template_value['instructor_details'] = ''
if self.template_value['video_exists']:
self.template_value['main_video'] = course['main_video']['url']
else:
self.template_value['main_video'] = ''
# CGL-MOOC-Builder: Set template value for instructor image and alt text.
self.set_instructor_image_and_alt()
# CGL-MOOC-Builder: Set template value for Google Community ID
self.set_google_community_template_value()
self.template_value['is_progress_recorded'] = (
CAN_PERSIST_ACTIVITY_EVENTS.value)
self.template_value['navbar'] = {'course': True}
# CGL-MOOC-Builder starts:
# Set template value for students progress bar that shows on the top navigation(header.html)
total_progress = (self.get_progress_tracker().get_overall_progress_score(student))
self.template_value['progress_value'] = total_progress.get('progress_score', 0)
self.template_value['complete_value'] = total_progress.get('completed_score', 0)
self.template_value['percentage'] = total_progress.get('percentage', '')
# Set template value for all lesson information in course_structure.html
all_lessons = {}
for u in self.template_value['units']:
if u.type == 'U':
all_lessons[u.unit_id] = get_all_lesson(self, u.unit_id)
self.template_value['all_lessons'] = all_lessons
# CGL-MOOC-Builder ends
self.render('home.html')
开发者ID:cglmoocs,项目名称:cgl-mooc-builder,代码行数:82,代码来源:lessons.py
示例17: get
def get(self):
"""Handles GET requests."""
user = self.personalize_page_and_get_user()
if user is None:
student = TRANSIENT_STUDENT
else:
student = Student.get_enrolled_student_by_email(user.email())
if not student:
student = TRANSIENT_STUDENT
# If the course is browsable, or the student is logged in and
# registered, redirect to the main course page.
if ((student and not student.is_transient) or
self.app_context.get_environ()['course']['browsable']):
self.redirect('/course')
return
self.template_value['transient_student'] = True
self.template_value['can_register'] = self.app_context.get_environ(
)['reg_form']['can_register']
self.template_value['navbar'] = {'course': True}
self.template_value['units'] = sorted(self.get_units(), key = lambda x: int(x.section_id or 999))
self.template_value['show_registration_page'] = True
course = self.app_context.get_environ()['course']
self.template_value['video_exists'] = bool(
'main_video' in course and
'url' in course['main_video'] and
course['main_video']['url'])
self.template_value['image_exists'] = bool(
'main_image' in course and
'url' in course['main_image'] and
course['main_image']['url'])
# CGL-MOOC-Builder starts:
# Set template values for instructor_details, main_video and
# Google Community ID.
if 'instructor_details' in course:
self.template_value['instructor_details'] = course['instructor_details']
else:
self.template_value['instructor_details'] = ''
if self.template_value['video_exists']:
self.template_value['main_video'] = course['main_video']['url']
else:
self.template_value['main_video'] = ''
# Set template value for instructor image and alt text
self.set_instructor_image_and_alt()
# Set template value for Google Community ID
self.set_google_community_template_value()
#if 'google_community_id' in course:
# self.template_value['google_community_id'] = course['google_community_id']
#else:
# self.template_value['google_communit_id'] = ''
# CGL-MOOC-Builder ends
# CGL-MOOC-Builder starts:
# Set template value for all lessons in course_structure_preview.html
all_lessons = {}
for u in self.template_value['units']:
if u.type == 'U':
all_lessons[u.unit_id] = self.get_all_lesson(u.unit_id)
self.template_value['all_lessons'] = all_lessons
# CGL-MOOC-Builder ends
if user:
profile = StudentProfileDAO.get_profile_by_user_id(user.user_id())
additional_registration_fields = self.app_context.get_environ(
)['reg_form']['additional_registration_fields']
if profile is not None and not additional_registration_fields:
self.template_value['show_registration_page'] = False
self.template_value['register_xsrf_token'] = (
XsrfTokenManager.create_xsrf_token('register-post'))
self.render('preview.html')
开发者ID:cglmoocs,项目名称:cgl-mooc-builder,代码行数:78,代码来源:utils.py
注:本文中的models.models.StudentProfileDAO类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论