Skip to content

Story 2410: Legal Pages Wagtail Integration#2465

Open
julhoang wants to merge 8 commits into
developfrom
julia/legal-pages-wagtail
Open

Story 2410: Legal Pages Wagtail Integration#2465
julhoang wants to merge 8 commits into
developfrom
julia/legal-pages-wagtail

Conversation

@julhoang

@julhoang julhoang commented May 20, 2026

Copy link
Copy Markdown
Collaborator

Issue: #2410

Summary & Context

Moves the Privacy Policy and Terms of Use pages into Wagtail so their content is editable in the CMS instead of hardcoded markdown, while keeping the pre-v3 markdown pages as a fallback until the v3 flag is fully rolled out.

Changes

Legal pages in Wagtail

  • Add a LegalPage model (title + rich text body) that Wagtail's router serves directly; the visible "Last Updated" date comes from Wagtail's built-in last_published_at, so republishing in the CMS updates it automatically.
  • Add a data migration that seeds the Privacy and Terms of Use pages under the home page with their current production copy and original publish dates.

Consolidate legal templates and styles

  • Replace the separate privacy_policy.html and terms_of_use.html templates with a single legal_page.html driven by the page's title and body.
  • Consolidate privacy-policy.css and terms-of-use.css into one legal-page.css.

Serve the pages, with a fallback during v3 rollout

  • Add LegalPageView: when the v3 flag is active it renders the Wagtail-backed page in legal_page.html; when it's off it falls back to the legacy markdown page. TermsOfUseView and PrivacyPolicyView subclass it and only set their slug.
  • Document the future switchover — dropping these views and routing the canonical URLs straight through Wagtail — with notes in core/views.py and config/urls.py so the plan isn't lost.

Header

  • Adjust header padding (roomier on desktop, unchanged on mobile).

Risks & Considerations

  • Feature-flag behavior: /privacy/ and /terms-of-use/ render two different ways depending on the v3 waffle flag (Wagtail content vs. legacy markdown). Both paths need checking.
  • Switchover deferred: the canonical URLs still go through Django views rather than Wagtail's router directly. That switchover is intentionally left for when v3 becomes the default and is documented inline.

Peer-Testing Guidelines

‼️ Please make sure your Wagtail CMS has been configured following this guideline from the Wagtail Integration PR ‼️

  1. Pull the branch and run docker compose exec web python manage.py migrate — this seeds the Privacy and Terms of Use pages.
  2. With the v3 flag on, visit http://localhost:8000/privacy/ and http://localhost:8000/terms-of-use/ and confirm the new design renders with a "Last Updated" date.
  3. In the Wagtail admin (http://localhost:8000/cms/), edit a legal page's body and republish; reload the page and confirm both the content and the "Last Updated" date reflect the edit.
  4. Turn the v3 flag off and reload both URLs — they should fall back to the legacy markdown pages.
  5. Confirm the pages also render when served directly by Wagtail at http://localhost:8000/pages/privacy/ and http://localhost:8000/pages/terms-of-use/.

Screenshots

Screenshot 2026-05-20 at 2 31 50 PM
Before After
Privacy Policy Privacy Policy
Terms of Use Terms of Use

Self-review Checklist

  • Tag at least one team member from each team to review this PR
  • Link this PR to the related GitHub Project ticket

Frontend

  • UI implementation matches Figma design
  • Tested in light and dark mode
  • Responsive / mobile verified
  • Accessibility checked (keyboard navigation, etc.)
  • Ensure design tokens are used for colors, spacing, typography, etc. – No hardcoded values
  • Test without JavaScript (if applicable)
  • No console errors or warnings

Summary by CodeRabbit

  • New Features

    • Added editable Privacy Policy and Terms of Use pages managed through the content editor.
    • Legal pages now display published content and the latest publication date automatically.
    • Added a shared, responsive layout for both legal pages.
  • Style

    • Updated legal-page typography, spacing, links, lists, and responsive behavior.
    • Improved header padding across desktop and mobile screen sizes.
  • Bug Fixes

    • Ensured updated legal content is displayed consistently when the new site experience is enabled.

@julhoang julhoang changed the title Julia/legal pages wagtail Story 2410: Legal Pages Wagtail Integration May 20, 2026
@julhoang julhoang linked an issue May 20, 2026 that may be closed by this pull request

@julioest julioest left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Ran the test plan and everything worked great, edits and reverse migration round-tripped cleanly too. Nice work, approving! ❇️

@jlchilders11 jlchilders11 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Overall, this looks like a good implementation! One change I'd like to see for when we do the big switchover

Comment thread core/views.py

def get_v3_context_data(self, **kwargs):
return {"last_updated": "2024-02-22"}
from pages.models import LegalPage

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

So, the intent of the RoutableHomePage model is to allow us to rely on the Wagtail router, rather than manually grabbing pages and populating them like this.

So we can use this methodology for now for testing/flagged switchover purposes, but as part of the deployment we should remove this view and have the url instead point to wagtail. I'd like to see those switchover notes added as a note so it is not lost.

Concrete changes

urls.py - Add a commented out route change for ease of switchover.

#  path("terms-of-use/", include(wagtail_urls)),

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Hi @jlchilders11 ! I've added the inline TODO note to remove this manual grabbing after the V3 switchover. Would you mind helping me re-review this PR? 🙏

Comment thread core/views.py Outdated
return {"last_updated": "2024-02-17"}
from pages.models import LegalPage

return {"page": LegalPage.objects.live().filter(slug="privacy").first()}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

ditto

@jlchilders11
jlchilders11 force-pushed the jc/wagtail-integration branch from 29dc2a1 to 9e354d6 Compare July 1, 2026 14:19
@julhoang
julhoang force-pushed the julia/legal-pages-wagtail branch from 5dc5260 to b4947fa Compare July 15, 2026 19:22
@coderabbitai

coderabbitai Bot commented Jul 15, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@julhoang, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 6 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: de506fad-8deb-4c60-a5f5-230439d50746

📥 Commits

Reviewing files that changed from the base of the PR and between b4947fa and 20529cf.

📒 Files selected for processing (1)
  • core/views.py
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch julia/legal-pages-wagtail

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@julhoang
julhoang changed the base branch from jc/wagtail-integration to develop July 15, 2026 19:22

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@core/views.py`:
- Around line 499-502: Update V3Mixin.get_v3_context_data to preserve the base
context passed through **kwargs by merging those kwargs into the returned
context alongside the LegalPage value. Keep the existing legal page lookup and
legal_slug filtering unchanged.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 705c5579-d930-4b9c-807f-c8bd2d442f51

📥 Commits

Reviewing files that changed from the base of the PR and between 865a4ac and b4947fa.

📒 Files selected for processing (12)
  • config/urls.py
  • core/views.py
  • pages/migrations/0005_legalpage.py
  • pages/migrations/0006_create_legal_pages.py
  • pages/models.py
  • static/css/v3/components.css
  • static/css/v3/header.css
  • static/css/v3/legal-page.css
  • static/css/v3/terms-of-use.css
  • templates/v3/legal_page.html
  • templates/v3/privacy_policy.html
  • templates/v3/terms_of_use.html
💤 Files with no reviewable changes (4)
  • templates/v3/terms_of_use.html
  • templates/v3/privacy_policy.html
  • static/css/v3/components.css
  • static/css/v3/terms-of-use.css

Comment thread core/views.py Outdated
@julhoang
julhoang requested a review from jlchilders11 July 15, 2026 20:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Webpage Integration: Legal Pages

4 participants