Add CMS management command to update course advanced settings in bulk. #197
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Needed a way to set course advanced fields through the Django management command line. Instead of call the REST PATCH endpoint here cms/djangoapps/contentstore/rest_api/v0/views/advanced_settings.py we utilized the
update_course_advanced_settings
method here cms/djangoapps/contentstore/views/course.py to pass JSON override values for one or more courses.A
--force-update-catalog-visibility-about
command option was added to include advanced setting. When upgrading from an older release toMaple
we had thiscatalog_visibility
set tonone
which produced theThere was an error loading this course
message when viewing the course MFE Learning frontend. It was necessary to make sure these courses didn't have thenone
value and receivedabout
orboth
settings to have the page load properly. This command sets the value toabout
to prevent the course from uploading to thecourse-discovery
service and out to the marketing frontend.Supporting information
We’re running into this issue mentioned above for students to be able to view the MFE learning page when Course Visibility in Catalog is set to none. The students receive the
There was an error loading this course.
message and nothing loads on the Course Home page. Also the LMS log files indicate no error messages so we were lucky to find this discussion article.Reference: https://discuss.openedx.org/t/how-to-programmatically-set-a-course-advanced-fields/8901
Testing instructions
When upgrading from prior release to
Maple
we had several courses withcourse_visibility
set tonone
value. With this setting we traversed to the MFE Learning frontend and saw error message withThere was an error loading this course.
and a HTTP 404 response from an EdX API endpoint in the JavaScript console was indicated.So to regenerate this error just set the
CMS > Advanced Settings > Catalog Visibility
value tonone
.HTTP 404 Response was at this address.
https://{{ LMS_HOST }}/api/course_home/course_metadata/course-v1:CUCWD+FAA-ACS-AM-ID-FLF+DOCUMENTATION?browser_timezone=America%2FNew_York
Invoking Management Command
WARNING
We added in a --limit-bulk-update-operation {0-N} command option to prevent the command from consuming all server memory and crashing the server. The default number of courses is set to 150. Please make sure that you pay attention to your server resources before running this command in bulk.
The user passed needs to have superuser rights.