本文整理汇总了Python中openedx.core.djangoapps.credit.models.CreditCourse.save方法的典型用法代码示例。如果您正苦于以下问题:Python CreditCourse.save方法的具体用法?Python CreditCourse.save怎么用?Python CreditCourse.save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类openedx.core.djangoapps.credit.models.CreditCourse
的用法示例。
在下文中一共展示了CreditCourse.save方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: add_credit_course
# 需要导入模块: from openedx.core.djangoapps.credit.models import CreditCourse [as 别名]
# 或者: from openedx.core.djangoapps.credit.models.CreditCourse import save [as 别名]
def add_credit_course(self, enabled=True):
"""
Mark the course as a credit.
"""
credit_course = CreditCourse(course_key=self.course_key, enabled=enabled)
credit_course.save()
return credit_course
示例2: test_course_details_with_enabled_setting
# 需要导入模块: from openedx.core.djangoapps.credit.models import CreditCourse [as 别名]
# 或者: from openedx.core.djangoapps.credit.models.CreditCourse import save [as 别名]
def test_course_details_with_enabled_setting(self):
"""
Test that credit eligibility requirements are present in
response if the feature flag 'ENABLE_CREDIT_ELIGIBILITY' is enabled.
"""
# verify that credit eligibility requirements block don't show if the
# course is not set as credit course
response = self.client.get_html(self.course_details_url)
self.assertEqual(response.status_code, 200)
self.assertNotContains(response, "Course Credit Requirements")
self.assertNotContains(response, "Steps required to earn course credit")
# verify that credit eligibility requirements block shows if the
# course is set as credit course and it has eligibility requirements
credit_course = CreditCourse(course_key=unicode(self.course.id), enabled=True)
credit_course.save()
self.assertEqual(len(get_credit_requirements(self.course.id)), 0)
# test that after publishing course, minimum grade requirement is added
on_course_publish(self.course.id)
self.assertEqual(len(get_credit_requirements(self.course.id)), 1)
response = self.client.get_html(self.course_details_url)
self.assertEqual(response.status_code, 200)
self.assertContains(response, "Course Credit Requirements")
self.assertContains(response, "Steps required to earn course credit")
示例3: add_credit_course
# 需要导入模块: from openedx.core.djangoapps.credit.models import CreditCourse [as 别名]
# 或者: from openedx.core.djangoapps.credit.models.CreditCourse import save [as 别名]
def add_credit_course(self):
""" Add the course as a credit
Returns:
CreditCourse object
"""
credit_course = CreditCourse(course_key=self.course_key, enabled=True)
credit_course.save()
return credit_course
示例4: add_credit_course
# 需要导入模块: from openedx.core.djangoapps.credit.models import CreditCourse [as 别名]
# 或者: from openedx.core.djangoapps.credit.models.CreditCourse import save [as 别名]
def add_credit_course(self, course_key):
"""Add the course as a credit.
Args:
course_key(CourseKey): Identifier for the course
Returns:
CreditCourse object added
"""
credit_course = CreditCourse(course_key=course_key, enabled=True)
credit_course.save()
return credit_course