Merge pull request #17699 from open-craft/clemente/add-coursefields-othercoursesettings
Add CourseFields.other_course_settings to store custom fields
This commit is contained in:
@@ -949,6 +949,22 @@ class CourseMetadataEditingTest(CourseTestCase):
|
||||
)
|
||||
self.assertNotIn('edxnotes', test_model)
|
||||
|
||||
@patch.dict(settings.FEATURES, {'ENABLE_OTHER_COURSE_SETTINGS': True})
|
||||
def test_othercoursesettings_present(self):
|
||||
"""
|
||||
If feature flag ENABLE_OTHER_COURSE_SETTINGS is on, show the setting in Advanced Settings.
|
||||
"""
|
||||
test_model = CourseMetadata.fetch(self.fullcourse)
|
||||
self.assertIn('other_course_settings', test_model)
|
||||
|
||||
@patch.dict(settings.FEATURES, {'ENABLE_OTHER_COURSE_SETTINGS': False})
|
||||
def test_othercoursesettings_not_present(self):
|
||||
"""
|
||||
If feature flag ENABLE_OTHER_COURSE_SETTINGS is off, don't show the setting at all in Advanced Settings.
|
||||
"""
|
||||
test_model = CourseMetadata.fetch(self.fullcourse)
|
||||
self.assertNotIn('other_course_settings', test_model)
|
||||
|
||||
def test_allow_unsupported_xblocks(self):
|
||||
"""
|
||||
allow_unsupported_xblocks is only shown in Advanced Settings if
|
||||
|
||||
@@ -78,6 +78,10 @@ class CourseMetadata(object):
|
||||
if not settings.FEATURES.get('ENABLE_EDXNOTES'):
|
||||
filtered_list.append('edxnotes')
|
||||
|
||||
# Do not show video auto advance if the feature is disabled
|
||||
if not settings.FEATURES.get('ENABLE_OTHER_COURSE_SETTINGS'):
|
||||
filtered_list.append('other_course_settings')
|
||||
|
||||
# Do not show video_upload_pipeline if the feature is disabled.
|
||||
if not settings.FEATURES.get('ENABLE_VIDEO_UPLOAD_PIPELINE'):
|
||||
filtered_list.append('video_upload_pipeline')
|
||||
|
||||
@@ -236,6 +236,10 @@ FEATURES = {
|
||||
# in sync with the one in lms/envs/common.py
|
||||
'ENABLE_EDXNOTES': False,
|
||||
|
||||
# Show a new field in "Advanced settings" that can store custom data about a
|
||||
# course and that can be read from themes
|
||||
'ENABLE_OTHER_COURSE_SETTINGS': False,
|
||||
|
||||
# Enable support for content libraries. Note that content libraries are
|
||||
# only supported in courses using split mongo.
|
||||
'ENABLE_CONTENT_LIBRARIES': True,
|
||||
|
||||
@@ -853,6 +853,15 @@ class CourseFields(object):
|
||||
),
|
||||
scope=Scope.settings, default=False
|
||||
)
|
||||
other_course_settings = Dict(
|
||||
display_name=_("Other Course Settings"),
|
||||
help=_(
|
||||
"Any additional information about the course that the platform needs or that allows integration with "
|
||||
"external systems such as CRM software. Enter a dictionary of values in JSON format, such as "
|
||||
"{ \"my_custom_setting\": \"value\", \"other_setting\": \"value\" }"
|
||||
),
|
||||
scope=Scope.settings
|
||||
)
|
||||
|
||||
|
||||
class CourseModule(CourseFields, SequenceModule): # pylint: disable=abstract-method
|
||||
|
||||
Reference in New Issue
Block a user