diff --git a/cms/djangoapps/contentstore/views/course.py b/cms/djangoapps/contentstore/views/course.py index 4920b46241..5d367fbe8f 100644 --- a/cms/djangoapps/contentstore/views/course.py +++ b/cms/djangoapps/contentstore/views/course.py @@ -121,13 +121,21 @@ def create_new_course(request): return JsonResponse( { 'ErrMsg': _('There is already a course defined with the same organization, course number, and course run. Please change at least one field to be unique.'), + 'OrgErrMsg': _('Either of organization or course number must be unique.'), + 'CourseErrMsg': _('Either of organization or course number must be unique.'), } ) course_search_location = ['i4x', dest_location.org, dest_location.course, 'course', None] courses = modulestore().get_items(course_search_location) if len(courses) > 0: - return JsonResponse({'ErrMsg': _('There is already a course defined with the same organization and course number. Please change at least one field to be unique.')}) + return JsonResponse( + { + 'ErrMsg': _('There is already a course defined with the same organization and course number. Please change at least one field to be unique.'), + 'OrgErrMsg': _('Either of organization or course number must be unique.'), + 'CourseErrMsg': _('Either of organization or course number must be unique.'), + } + ) # instantiate the CourseDescriptor and then persist it # note: no system to pass diff --git a/cms/static/js/base.js b/cms/static/js/base.js index 9f992d5ab2..04551dd283 100644 --- a/cms/static/js/base.js +++ b/cms/static/js/base.js @@ -677,7 +677,9 @@ function saveNewCourse(e) { if (data.id !== undefined) { window.location = '/' + data.id.replace(/.*:\/\//, ''); } else if (data.ErrMsg !== undefined) { - setNewCourseErrMsgs(data.ErrMsg, null, null, null, null); + orgErrMsg = (data.OrgErrMsg !== undefined) ? data.OrgErrMsg : null; + courseErrMsg = (data.CourseErrMsg !== undefined) ? data.CourseErrMsg : null; + setNewCourseErrMsgs(data.ErrMsg, null, orgErrMsg, courseErrMsg, null); } } );