Adds in radio button patch request and text for page
EDUCATOR-229
This commit is contained in:
@@ -120,7 +120,7 @@ class CourseDiscussionSettingsTest(ModuleStoreTestCase):
|
||||
def test_invalid_data_types(self):
|
||||
exception_msg_template = "Incorrect field type for `{}`. Type must be `{}`"
|
||||
fields = [
|
||||
{'name': 'division_scheme', 'type': str},
|
||||
{'name': 'division_scheme', 'type': basestring},
|
||||
{'name': 'always_divide_inline_discussions', 'type': bool},
|
||||
{'name': 'divided_discussions', 'type': list}
|
||||
]
|
||||
|
||||
@@ -130,12 +130,13 @@ def set_course_discussion_settings(course_key, **kwargs):
|
||||
Returns:
|
||||
A CourseDiscussionSettings object.
|
||||
"""
|
||||
fields = {'division_scheme': str, 'always_divide_inline_discussions': bool, 'divided_discussions': list}
|
||||
fields = {'division_scheme': basestring, 'always_divide_inline_discussions': bool, 'divided_discussions': list}
|
||||
course_discussion_settings = get_course_discussion_settings(course_key)
|
||||
for field, field_type in fields.items():
|
||||
if field in kwargs:
|
||||
if not isinstance(kwargs[field], field_type):
|
||||
raise ValueError("Incorrect field type for `{}`. Type must be `{}`".format(field, field_type.__name__))
|
||||
setattr(course_discussion_settings, field, kwargs[field])
|
||||
course_discussion_settings.save()
|
||||
|
||||
course_discussion_settings.save()
|
||||
return course_discussion_settings
|
||||
|
||||
Reference in New Issue
Block a user