本文整理汇总了Python中util.milestones_helpers.is_prerequisite_courses_enabled函数的典型用法代码示例。如果您正苦于以下问题:Python is_prerequisite_courses_enabled函数的具体用法?Python is_prerequisite_courses_enabled怎么用?Python is_prerequisite_courses_enabled使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了is_prerequisite_courses_enabled函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: handle_post_cert_generated
def handle_post_cert_generated(sender, instance, **kwargs): # pylint: disable=unused-argument
"""
Handles post_save signal of GeneratedCertificate, and mark user collected
course milestone entry if user has passed the course.
User is assumed to have passed the course if certificate status is either 'generating' or 'downloadable'.
"""
allowed_cert_states = [CertificateStatuses.generating, CertificateStatuses.downloadable]
if is_prerequisite_courses_enabled() and instance.status in allowed_cert_states:
fulfill_course_milestone(instance.course_id, instance.user)
示例2: test_pre_requisite_courses_enabled
def test_pre_requisite_courses_enabled(self, feature_flags):
"""
Tests is_prerequisite_courses_enabled function with a set of possible values for
ENABLE_PREREQUISITE_COURSES and MILESTONES_APP feature flags.
"""
with patch.dict("django.conf.settings.FEATURES", {
'ENABLE_PREREQUISITE_COURSES': feature_flags[0],
'MILESTONES_APP': feature_flags[1]
}):
self.assertEqual(feature_flags[2], milestones_helpers.is_prerequisite_courses_enabled())
示例3: _is_prerequisites_disabled
def _is_prerequisites_disabled():
"""
Checks if prerequisites are disabled in the settings.
"""
return ACCESS_DENIED if is_prerequisite_courses_enabled() else ACCESS_GRANTED
示例4: handle_course_cert_awarded
def handle_course_cert_awarded(sender, user, course_key, **kwargs): # pylint: disable=unused-argument
"""
Mark a milestone entry if user has passed the course.
"""
if is_prerequisite_courses_enabled():
fulfill_course_milestone(course_key, user)