Skip to content

10405 add display mode field for mitxonline programs returned in the api#3358

Merged
cp-at-mit merged 16 commits intomainfrom
10405-add-display_mode-field-for-mitxonline-programs-returned-in-the-api
Mar 10, 2026
Merged

10405 add display mode field for mitxonline programs returned in the api#3358
cp-at-mit merged 16 commits intomainfrom
10405-add-display_mode-field-for-mitxonline-programs-returned-in-the-api

Conversation

@cp-at-mit
Copy link
Contributor

@cp-at-mit cp-at-mit commented Mar 6, 2026

What are the relevant tickets?

https://github.com/mitodl/hq/issues/10405

Description (What does it do?)

Adds a display_mode field to the Program model, and uses it in the APIs.

How can this be tested?

Create a program and verify that APIs liek http://mitxonline.odl.local:8013/api/schema/swagger-ui/#/programs/programs_list_v2 return the display_mode field.

Add display_mode to the serialized fields for program objects across API versions so the attribute is included in responses. Updated BaseProgramSerializer (v1), ProgramSerializer (v2), and SimpleProgramSerializer (v3) to include display_mode.
@github-actions
Copy link

github-actions bot commented Mar 6, 2026

OpenAPI Changes

Show/hide ## Changes for v0.yaml:
## Changes for v0.yaml:
21 changes: 0 error, 0 warning, 21 info
info	[response-optional-property-added] at head/openapi/specs/v0.yaml	
	in API GET /api/v2/course_certificates/{cert_uuid}/
		added the optional property 'course_run/course/allOf[#/components/schemas/V2Course]/programs/items/display_mode' to the response with the '200' status

info	[response-optional-property-added] at head/openapi/specs/v0.yaml	
	in API GET /api/v2/courses/
		added the optional property 'results/items/programs/items/display_mode' to the response with the '200' status

info	[response-optional-property-added] at head/openapi/specs/v0.yaml	
	in API GET /api/v2/courses/{id}/
		added the optional property 'programs/items/display_mode' to the response with the '200' status

info	[response-optional-property-added] at head/openapi/specs/v0.yaml	
	in API GET /api/v2/enrollments/
		added the optional property '/items/run/allOf[#/components/schemas/V2CourseRunWithCourse]/course/allOf[#/components/schemas/V2Course]/programs/items/display_mode' to the response with the '200' status

info	[response-optional-property-added] at head/openapi/specs/v0.yaml	
	in API POST /api/v2/enrollments/
		added the optional property 'run/allOf[#/components/schemas/V2CourseRunWithCourse]/course/allOf[#/components/schemas/V2Course]/programs/items/display_mode' to the response with the '201' status

info	[response-optional-property-added] at head/openapi/specs/v0.yaml	
	in API GET /api/v2/pages/?fields=*&type=cms.coursepage
		added the optional property 'items/items/course_details/programs/items/display_mode' to the response with the '200' status

info	[response-optional-property-added] at head/openapi/specs/v0.yaml	
	in API GET /api/v2/pages/?fields=*&type=cms.programpage
		added the optional property 'items/items/program_details/display_mode' to the response with the '200' status

info	[response-optional-property-added] at head/openapi/specs/v0.yaml	
	in API GET /api/v2/pages/{id}/
		added the optional property '/oneOf[#/components/schemas/CoursePageItem]/course_details/programs/items/display_mode' to the response with the '200' status

info	[response-optional-property-added] at head/openapi/specs/v0.yaml	
	in API GET /api/v2/pages/{id}/
		added the optional property '/oneOf[#/components/schemas/ProgramPageItem]/program_details/display_mode' to the response with the '200' status

info	[response-optional-property-added] at head/openapi/specs/v0.yaml	
	in API GET /api/v2/program_certificates/{cert_uuid}/
		added the optional property 'program/display_mode' to the response with the '200' status

info	[response-optional-property-added] at head/openapi/specs/v0.yaml	
	in API GET /api/v2/program_enrollments/
		added the optional property '/items/enrollments/items/run/allOf[#/components/schemas/V2CourseRunWithCourse]/course/allOf[#/components/schemas/V2Course]/programs/items/display_mode' to the response with the '200' status

info	[response-optional-property-added] at head/openapi/specs/v0.yaml	
	in API GET /api/v2/program_enrollments/
		added the optional property '/items/program/display_mode' to the response with the '200' status

info	[response-optional-property-added] at head/openapi/specs/v0.yaml	
	in API DELETE /api/v2/program_enrollments/{id}/
		added the optional property '/items/enrollments/items/run/allOf[#/components/schemas/V2CourseRunWithCourse]/course/allOf[#/components/schemas/V2Course]/programs/items/display_mode' to the response with the '200' status

info	[response-optional-property-added] at head/openapi/specs/v0.yaml	
	in API DELETE /api/v2/program_enrollments/{id}/
		added the optional property '/items/program/display_mode' to the response with the '200' status

info	[response-optional-property-added] at head/openapi/specs/v0.yaml	
	in API GET /api/v2/program_enrollments/{id}/
		added the optional property 'enrollments/items/run/allOf[#/components/schemas/V2CourseRunWithCourse]/course/allOf[#/components/schemas/V2Course]/programs/items/display_mode' to the response with the '200' status

info	[response-optional-property-added] at head/openapi/specs/v0.yaml	
	in API GET /api/v2/program_enrollments/{id}/
		added the optional property 'program/display_mode' to the response with the '200' status

info	[response-optional-property-added] at head/openapi/specs/v0.yaml	
	in API GET /api/v2/programs/
		added the optional property 'results/items/display_mode' to the response with the '200' status

info	[response-optional-property-added] at head/openapi/specs/v0.yaml	
	in API GET /api/v2/programs/{id}/
		added the optional property 'display_mode' to the response with the '200' status

info	[response-optional-property-added] at head/openapi/specs/v0.yaml	
	in API POST /api/v2/verified_program_enrollments/{program_id}/{courserun_id}/
		added the optional property 'run/allOf[#/components/schemas/V2CourseRunWithCourse]/course/allOf[#/components/schemas/V2Course]/programs/items/display_mode' to the response with the '201' status

info	[response-optional-property-added] at head/openapi/specs/v0.yaml	
	in API GET /api/v3/program_enrollments/
		added the optional property '/items/program/allOf[#/components/schemas/V3SimpleProgram]/display_mode' to the response with the '200' status

info	[response-optional-property-added] at head/openapi/specs/v0.yaml	
	in API GET /api/v3/program_enrollments/{program_id}/
		added the optional property 'program/allOf[#/components/schemas/V3SimpleProgram]/display_mode' to the response with the '200' status



## Changes for v1.yaml:
21 changes: 0 error, 0 warning, 21 info
info	[response-optional-property-added] at head/openapi/specs/v1.yaml	
	in API GET /api/v2/course_certificates/{cert_uuid}/
		added the optional property 'course_run/course/allOf[#/components/schemas/V2Course]/programs/items/display_mode' to the response with the '200' status

info	[response-optional-property-added] at head/openapi/specs/v1.yaml	
	in API GET /api/v2/courses/
		added the optional property 'results/items/programs/items/display_mode' to the response with the '200' status

info	[response-optional-property-added] at head/openapi/specs/v1.yaml	
	in API GET /api/v2/courses/{id}/
		added the optional property 'programs/items/display_mode' to the response with the '200' status

info	[response-optional-property-added] at head/openapi/specs/v1.yaml	
	in API GET /api/v2/enrollments/
		added the optional property '/items/run/allOf[#/components/schemas/V2CourseRunWithCourse]/course/allOf[#/components/schemas/V2Course]/programs/items/display_mode' to the response with the '200' status

info	[response-optional-property-added] at head/openapi/specs/v1.yaml	
	in API POST /api/v2/enrollments/
		added the optional property 'run/allOf[#/components/schemas/V2CourseRunWithCourse]/course/allOf[#/components/schemas/V2Course]/programs/items/display_mode' to the response with the '201' status

info	[response-optional-property-added] at head/openapi/specs/v1.yaml	
	in API GET /api/v2/pages/?fields=*&type=cms.coursepage
		added the optional property 'items/items/course_details/programs/items/display_mode' to the response with the '200' status

info	[response-optional-property-added] at head/openapi/specs/v1.yaml	
	in API GET /api/v2/pages/?fields=*&type=cms.programpage
		added the optional property 'items/items/program_details/display_mode' to the response with the '200' status

info	[response-optional-property-added] at head/openapi/specs/v1.yaml	
	in API GET /api/v2/pages/{id}/
		added the optional property '/oneOf[#/components/schemas/CoursePageItem]/course_details/programs/items/display_mode' to the response with the '200' status

info	[response-optional-property-added] at head/openapi/specs/v1.yaml	
	in API GET /api/v2/pages/{id}/
		added the optional property '/oneOf[#/components/schemas/ProgramPageItem]/program_details/display_mode' to the response with the '200' status

info	[response-optional-property-added] at head/openapi/specs/v1.yaml	
	in API GET /api/v2/program_certificates/{cert_uuid}/
		added the optional property 'program/display_mode' to the response with the '200' status

info	[response-optional-property-added] at head/openapi/specs/v1.yaml	
	in API GET /api/v2/program_enrollments/
		added the optional property '/items/enrollments/items/run/allOf[#/components/schemas/V2CourseRunWithCourse]/course/allOf[#/components/schemas/V2Course]/programs/items/display_mode' to the response with the '200' status

info	[response-optional-property-added] at head/openapi/specs/v1.yaml	
	in API GET /api/v2/program_enrollments/
		added the optional property '/items/program/display_mode' to the response with the '200' status

info	[response-optional-property-added] at head/openapi/specs/v1.yaml	
	in API DELETE /api/v2/program_enrollments/{id}/
		added the optional property '/items/enrollments/items/run/allOf[#/components/schemas/V2CourseRunWithCourse]/course/allOf[#/components/schemas/V2Course]/programs/items/display_mode' to the response with the '200' status

info	[response-optional-property-added] at head/openapi/specs/v1.yaml	
	in API DELETE /api/v2/program_enrollments/{id}/
		added the optional property '/items/program/display_mode' to the response with the '200' status

info	[response-optional-property-added] at head/openapi/specs/v1.yaml	
	in API GET /api/v2/program_enrollments/{id}/
		added the optional property 'enrollments/items/run/allOf[#/components/schemas/V2CourseRunWithCourse]/course/allOf[#/components/schemas/V2Course]/programs/items/display_mode' to the response with the '200' status

info	[response-optional-property-added] at head/openapi/specs/v1.yaml	
	in API GET /api/v2/program_enrollments/{id}/
		added the optional property 'program/display_mode' to the response with the '200' status

info	[response-optional-property-added] at head/openapi/specs/v1.yaml	
	in API GET /api/v2/programs/
		added the optional property 'results/items/display_mode' to the response with the '200' status

info	[response-optional-property-added] at head/openapi/specs/v1.yaml	
	in API GET /api/v2/programs/{id}/
		added the optional property 'display_mode' to the response with the '200' status

info	[response-optional-property-added] at head/openapi/specs/v1.yaml	
	in API POST /api/v2/verified_program_enrollments/{program_id}/{courserun_id}/
		added the optional property 'run/allOf[#/components/schemas/V2CourseRunWithCourse]/course/allOf[#/components/schemas/V2Course]/programs/items/display_mode' to the response with the '201' status

info	[response-optional-property-added] at head/openapi/specs/v1.yaml	
	in API GET /api/v3/program_enrollments/
		added the optional property '/items/program/allOf[#/components/schemas/V3SimpleProgram]/display_mode' to the response with the '200' status

info	[response-optional-property-added] at head/openapi/specs/v1.yaml	
	in API GET /api/v3/program_enrollments/{program_id}/
		added the optional property 'program/allOf[#/components/schemas/V3SimpleProgram]/display_mode' to the response with the '200' status



## Changes for v2.yaml:
21 changes: 0 error, 0 warning, 21 info
info	[response-optional-property-added] at head/openapi/specs/v2.yaml	
	in API GET /api/v2/course_certificates/{cert_uuid}/
		added the optional property 'course_run/course/allOf[#/components/schemas/V2Course]/programs/items/display_mode' to the response with the '200' status

info	[response-optional-property-added] at head/openapi/specs/v2.yaml	
	in API GET /api/v2/courses/
		added the optional property 'results/items/programs/items/display_mode' to the response with the '200' status

info	[response-optional-property-added] at head/openapi/specs/v2.yaml	
	in API GET /api/v2/courses/{id}/
		added the optional property 'programs/items/display_mode' to the response with the '200' status

info	[response-optional-property-added] at head/openapi/specs/v2.yaml	
	in API GET /api/v2/enrollments/
		added the optional property '/items/run/allOf[#/components/schemas/V2CourseRunWithCourse]/course/allOf[#/components/schemas/V2Course]/programs/items/display_mode' to the response with the '200' status

info	[response-optional-property-added] at head/openapi/specs/v2.yaml	
	in API POST /api/v2/enrollments/
		added the optional property 'run/allOf[#/components/schemas/V2CourseRunWithCourse]/course/allOf[#/components/schemas/V2Course]/programs/items/display_mode' to the response with the '201' status

info	[response-optional-property-added] at head/openapi/specs/v2.yaml	
	in API GET /api/v2/pages/?fields=*&type=cms.coursepage
		added the optional property 'items/items/course_details/programs/items/display_mode' to the response with the '200' status

info	[response-optional-property-added] at head/openapi/specs/v2.yaml	
	in API GET /api/v2/pages/?fields=*&type=cms.programpage
		added the optional property 'items/items/program_details/display_mode' to the response with the '200' status

info	[response-optional-property-added] at head/openapi/specs/v2.yaml	
	in API GET /api/v2/pages/{id}/
		added the optional property '/oneOf[#/components/schemas/CoursePageItem]/course_details/programs/items/display_mode' to the response with the '200' status

info	[response-optional-property-added] at head/openapi/specs/v2.yaml	
	in API GET /api/v2/pages/{id}/
		added the optional property '/oneOf[#/components/schemas/ProgramPageItem]/program_details/display_mode' to the response with the '200' status

info	[response-optional-property-added] at head/openapi/specs/v2.yaml	
	in API GET /api/v2/program_certificates/{cert_uuid}/
		added the optional property 'program/display_mode' to the response with the '200' status

info	[response-optional-property-added] at head/openapi/specs/v2.yaml	
	in API GET /api/v2/program_enrollments/
		added the optional property '/items/enrollments/items/run/allOf[#/components/schemas/V2CourseRunWithCourse]/course/allOf[#/components/schemas/V2Course]/programs/items/display_mode' to the response with the '200' status

info	[response-optional-property-added] at head/openapi/specs/v2.yaml	
	in API GET /api/v2/program_enrollments/
		added the optional property '/items/program/display_mode' to the response with the '200' status

info	[response-optional-property-added] at head/openapi/specs/v2.yaml	
	in API DELETE /api/v2/program_enrollments/{id}/
		added the optional property '/items/enrollments/items/run/allOf[#/components/schemas/V2CourseRunWithCourse]/course/allOf[#/components/schemas/V2Course]/programs/items/display_mode' to the response with the '200' status

info	[response-optional-property-added] at head/openapi/specs/v2.yaml	
	in API DELETE /api/v2/program_enrollments/{id}/
		added the optional property '/items/program/display_mode' to the response with the '200' status

info	[response-optional-property-added] at head/openapi/specs/v2.yaml	
	in API GET /api/v2/program_enrollments/{id}/
		added the optional property 'enrollments/items/run/allOf[#/components/schemas/V2CourseRunWithCourse]/course/allOf[#/components/schemas/V2Course]/programs/items/display_mode' to the response with the '200' status

info	[response-optional-property-added] at head/openapi/specs/v2.yaml	
	in API GET /api/v2/program_enrollments/{id}/
		added the optional property 'program/display_mode' to the response with the '200' status

info	[response-optional-property-added] at head/openapi/specs/v2.yaml	
	in API GET /api/v2/programs/
		added the optional property 'results/items/display_mode' to the response with the '200' status

info	[response-optional-property-added] at head/openapi/specs/v2.yaml	
	in API GET /api/v2/programs/{id}/
		added the optional property 'display_mode' to the response with the '200' status

info	[response-optional-property-added] at head/openapi/specs/v2.yaml	
	in API POST /api/v2/verified_program_enrollments/{program_id}/{courserun_id}/
		added the optional property 'run/allOf[#/components/schemas/V2CourseRunWithCourse]/course/allOf[#/components/schemas/V2Course]/programs/items/display_mode' to the response with the '201' status

info	[response-optional-property-added] at head/openapi/specs/v2.yaml	
	in API GET /api/v3/program_enrollments/
		added the optional property '/items/program/allOf[#/components/schemas/V3SimpleProgram]/display_mode' to the response with the '200' status

info	[response-optional-property-added] at head/openapi/specs/v2.yaml	
	in API GET /api/v3/program_enrollments/{program_id}/
		added the optional property 'program/allOf[#/components/schemas/V3SimpleProgram]/display_mode' to the response with the '200' status



Unexpected changes? Ensure your branch is up-to-date with main (consider rebasing).

cp-at-mit and others added 8 commits March 6, 2026 10:21
Update tests to include the new 'display_mode' field in the expected serialized program output. The test now asserts 'display_mode': None for a program with empty requirements, matching the serializer's output change in courses/serializers/v2/programs_test.py.
…turned-in-the-api' of https://github.com/mitodl/mitxonline into 10405-add-display_mode-field-for-mitxonline-programs-returned-in-the-api
@cp-at-mit cp-at-mit marked this pull request as ready for review March 9, 2026 18:37
Copy link
Contributor

@ChristopherChudzicki ChristopherChudzicki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Working....Two requests, but neither warrants a re-review, IMO.

search_fields = ["title", "readable_id", "program_type"]
list_display = ("id", "title", "live", "readable_id", "program_type")
list_filter = ["live", "program_type", "departments"]
list_display = (
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should add it to ProgramAdminForm.Meta.fields, too, so we can change it in Django Admin.

@cp-at-mit cp-at-mit merged commit aeb51f5 into main Mar 10, 2026
10 checks passed
@cp-at-mit cp-at-mit deleted the 10405-add-display_mode-field-for-mitxonline-programs-returned-in-the-api branch March 10, 2026 15:30
@odlbot odlbot mentioned this pull request Mar 10, 2026
7 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants