本文整理汇总了Python中certificates.models.CertificateGenerationCourseSetting.is_language_specific_templates_enabled_for_course方法的典型用法代码示例。如果您正苦于以下问题:Python CertificateGenerationCourseSetting.is_language_specific_templates_enabled_for_course方法的具体用法?Python CertificateGenerationCourseSetting.is_language_specific_templates_enabled_for_course怎么用?Python CertificateGenerationCourseSetting.is_language_specific_templates_enabled_for_course使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类certificates.models.CertificateGenerationCourseSetting
的用法示例。
在下文中一共展示了CertificateGenerationCourseSetting.is_language_specific_templates_enabled_for_course方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _update_course_context
# 需要导入模块: from certificates.models import CertificateGenerationCourseSetting [as 别名]
# 或者: from certificates.models.CertificateGenerationCourseSetting import is_language_specific_templates_enabled_for_course [as 别名]
def _update_course_context(request, context, course, course_key, platform_name):
"""
Updates context dictionary with course info.
"""
context['full_course_image_url'] = request.build_absolute_uri(course_image_url(course))
course_title_from_cert = context['certificate_data'].get('course_title', '')
accomplishment_copy_course_name = course_title_from_cert if course_title_from_cert else course.display_name
context['accomplishment_copy_course_name'] = accomplishment_copy_course_name
course_number = course.display_coursenumber if course.display_coursenumber else course.number
context['course_number'] = course_number
if context['organization_long_name']:
# Translators: This text represents the description of course
context['accomplishment_copy_course_description'] = _('a course of study offered by {partner_short_name}, '
'an online learning initiative of '
'{partner_long_name}.').format(
partner_short_name=context['organization_short_name'],
partner_long_name=context['organization_long_name'],
platform_name=platform_name)
else:
# Translators: This text represents the description of course
context['accomplishment_copy_course_description'] = _('a course of study offered by '
'{partner_short_name}.').format(
partner_short_name=context['organization_short_name'],
platform_name=platform_name)
# If language specific templates are enabled for the course, add course_run specific information to the context
if CertificateGenerationCourseSetting.is_language_specific_templates_enabled_for_course(course_key):
fields = ['start', 'end', 'max_effort', 'language']
course_run_data = get_course_run_details(course_key, fields)
context.update(course_run_data)