feat(product-pages): expose CMS-managed testimonials on course and program pages - #3987
Merged
Merged
Conversation
OpenAPI ChangesShow/hide changesUnexpected changes? Ensure your branch is up-to-date with |
Contributor
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
The implemented 600-character editorial guidance conflicts with the PR’s documented 500-character guidance.
Get a fresh assessment by requesting another Copilot review.
Review effort: Balanced
Findings: 1
Open (1)
What changed in this PR
Adds CMS-managed testimonials to course and program pages and exposes them through the Wagtail API.
Changes:
- Adds the testimonial model, editor panel, serialization, and migration.
- Prefetches testimonial images and tests ordering, empty states, and query behavior.
- Updates generated OpenAPI schemas.
| File | Description |
|---|---|
cms/models.py |
Defines testimonials and exposes them on product pages. |
cms/serializers.py |
Serializes testimonial API data. |
cms/migrations/0069_add_product_page_testimonial.py |
Creates the testimonial table. |
cms/wagtail_api/views.py |
Prefetches testimonials and images. |
cms/wagtail_api/views_test.py |
Tests testimonial API behavior and performance. |
cms/wagtail_api/schema/serializers.py |
Adds testimonial schema definitions. |
openapi/specs/v0.yaml |
Updates v0 API schema. |
openapi/specs/v1.yaml |
Updates v1 API schema. |
openapi/specs/v2.yaml |
Updates v2 API schema. |
drf_lint_baseline.json |
Adjusts shifted lint-baseline location. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
zamanafzal
force-pushed
the
zafzal/13286-testimonials-product-pages
branch
from
September 21, 2026 11:02
ce41cae to
6ebad5a
Compare
zamanafzal
force-pushed
the
zafzal/13286-testimonials-product-pages
branch
from
September 22, 2026 06:39
6ebad5a to
17fea28
Compare
…ogram pages Add an optional Testimonials section that CMS authors manage per Course/Program page, exposed through the Wagtail v2 API — same pattern as the FAQ feature (mitxonline#3961). Backend only. - New ProductPageTestimonial(Orderable) model: quote and name required, title and image optional. ParentalKey targets Page (like faqs_list), so only Course/Program pages surface it via InlinePanel + APIField. - ProductPageTestimonialSerializer exposes id, quote, name, title, and image_src (resolved via get_wagtail_img_src, null when no image). - Prefetch testimonials_list__image for testimonials/* field requests to avoid an N+1 on the listing route. - Help-text length guidance (quote 600, name 40, title 80) with no hard schema limits. - Add the TestimonialItem schema serializer and regenerate the OpenAPI specs. drf_lint_baseline.json: repoint the cms/serializers.py InstructorPage feature_image line for this change, and realign the flexiblepricing entries that drifted on main (0f1a2c2 changed the file without regenerating the baseline) so the pinned drf-lint hook passes. mitodl/hq#13286
zamanafzal
force-pushed
the
zafzal/13286-testimonials-product-pages
branch
from
September 22, 2026 08:24
6501e4a to
3acfd17
Compare
annagav
self-requested a review
September 22, 2026 12:58
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.

What are the relevant tickets?
https://github.com/mitodl/hq/issues/13286
Related ticket and PRs:
Description (What does it do?)
Adds an optional Testimonials section that CMS authors manage per Course/Program page, exposed through the Wagtail v2 API — the same pattern as the FAQ feature (mitxonline#3961). Backend only; the MIT Learn frontend rendering is a separate change.
ProductPageTestimonial(Orderable)model: quote and name required, title and image optional.ParentalKeytargetsPage(likefaqs_list), so only Course/Program pages surface it via theirInlinePanel+APIField("testimonials").ProductPageTestimonialSerializerexposesid,quote,name,title, andimage_src(resolved viaget_wagtail_img_src,nullwhen no image).testimonials_listfortestimonials/*field requests to avoid an N+1 on the listing route.Orderable.sort_order). Adds theTestimonialItemschema serializer and regenerates the OpenAPI specs. No feature flag — release is managed via the CMS.Screenshots (if appropriate):
How can this be tested?
Apply the migration and start the stack:
Open the Wagtail admin at http://mitxonline.odl.local:8013/cms/ and edit any Course or Program page. Note its numeric page id from the admin URL (
…/pages/<PAGE_ID>/edit/).Scroll to the new Testimonials section → Add testimonial. Add two rows, each with a quote and name (set title + image on one, leave both blank on the other), reorder them via the drag handles, then Publish. → Both rows save and the drag order is preserved.
Open the page in the Wagtail v2 API in your browser (it renders the JSON). The
typeparam is required — the detail route only allows anonymous access for known page types; without it you get a403(usetype=cms.programpagefor a Program page):http://mitxonline.odl.local:8013/api/v2/pages/<PAGE_ID>/?type=cms.coursepage&fields=testimonials→ Returns the testimonials in the order you arranged them, each with
id,quote,name,title, andimage_src(a URL for the row with an image,nullfor the one without).Confirm the empty state on a page with no testimonials:
http://mitxonline.odl.local:8013/api/v2/pages/<OTHER_PAGE_ID>/?type=cms.coursepage&fields=testimonials→ Returns
"testimonials": [].Additional Context
Backend only — the MIT Learn frontend that renders this section is a separate, dependent PR (same pattern as the FAQ rollout).