feat: bulk add courses to base catalog - #67
Conversation
|
@ccantillo in future please add screenshots! I have tested locally and it seems to be working fine. Nevertheless, this is not good enough! The functionality requested needs to be improved. We can't just "Add Bulk Courses" but also we need to improve it so it is a "Manage Bulk Courses". Screenshots of the corporate module:
Screenshot of Manage User Group:
On refresh it still loads the existing groups. |
Hi @igobranco, thanks for the feedback! Reworked the implementation to match the auth/group pattern. The "Bulk Add Courses" separate page is gone — the FilteredSelectMultiple widget now lives directly on the BaseCatalog change form, pre-populated with the catalog's current courses on load. A single Save now handles both additions and removals: it diffs the selected set against the current BaseCatalogCourse entries, creates the new ones (preserving added_by/added_at metadata), and deletes the removed ones.
|








Bulk add courses to Base Catalog
Summary
Administrators could only add one course at a time to the Base Catalog, which
was impractical when dealing with dozens or hundreds of courses. This PR adds a
Bulk Add Courses page to the
BaseCatalogadmin interface, featuring avisual dual-panel course picker with search, select, and batch-add capabilities.
What changed
partner_catalog/admin.pyBulkAddCoursesForm— a Django form using theFilteredSelectMultiplewidget, which renders the built-in Django admin dual-panel picker.
get_urls()toBaseCatalogAdminto register a custom admin route:/<uuid>/bulk-add-courses/bulk_add_courses_view()— handles GET (render picker) and POST (saveselected courses). Courses are added via
BaseCatalogCourse.get_or_create,so duplicate submissions are safe.
add_course_button(detail page) to show two buttons:+ Add Single Course (existing flow) and + Bulk Add Courses (new).
add_course(list view column) to link directly to the bulk-add page.partner_catalog/templates/admin/partner_catalog/basecatalog/bulk_add_courses.htmlNew admin template extending
admin/base_site.htmlwith proper CSS(
admin/css/forms.css) and JS (jsi18n+ combined admin+form media) loading.How the picker works
The Available Courses panel (left) lists all courses not yet in the
catalog, sorted alphabetically. The Chosen Courses panel (right) holds the
courses selected for addition.
Ctrl + click(orCmd + clickon Mac) each courseOnce the desired courses are in the right panel, click Add Selected Courses
to save. The admin redirects back to the BaseCatalog detail page and shows a
success message with the count of courses added.
Files changed
openedx-corporatepartner_catalog/admin.pyBulkAddCoursesForm,get_urls,bulk_add_courses_view, updated buttonsopenedx-corporatepartner_catalog/templates/admin/partner_catalog/basecatalog/bulk_add_courses.htmlTesting
/admin/partner_catalog/basecatalog/.the green + Bulk Add Courses button.
Ctrl + clickto multi-select, and the arrow buttons tomove courses to the right panel.
with a success message confirming how many courses were added.
appear in the Available Courses panel.