Story 2410: Legal Pages Wagtail Integration#2465
Open
julhoang wants to merge 3 commits into
Open
Conversation
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.
Issue: #2410
Summary & Context
Migrates Privacy Policy and Terms of Use content out of hardcoded templates into Wagtail-managed
LegalPageinstances, and consolidates the two near-identical templates into one sharedlegal_page.html. Editors can now update copy and the "Last Updated" date from the Wagtail admin instead of editing templates.Changes
LegalPageWagtail model (pages/models.py) —BasePagesubclass with aRichTextFieldbody using the project'sRICH_TEXT_FEATURES, parented underRoutableHomePage.0002_legalpage– schema for the new model.0003_create_legal_pages– data migration that seeds Privacy Policy and Terms of Use underRoutableHomePagewith prod-matching copy, and a reverse op that deletes them by slug.templates/v3/legal_page.html– new template renders anyLegalPage(title,last_published_at-driven "Last Updated", rich-text body).templates/v3/privacy_policy.html,templates/v3/terms_of_use.html– removed.core/views.py:TermsOfUseView/PrivacyPolicyViewnow resolve the correspondingLegalPageby slug (terms-of-use,privacy) and pass it to the template.last_updatedstrings — the visible date now comes frompage.last_published_at, so republishing in Wagtail updates it automatically.static/css/v3/legal-page.cssstatic/css/v3/header.csspadding (--space-default/--space-largeon desktop, reverts to--space-mediumon mobile) to match the legal page layout.Peer Review Testing (Wagtail CMS)
LegalPagemodel and seed the two pages:./manage.py createsuperuserif needed).RoutableHomePage) — you should see Privacy Policy and Terms of Use as children.legal-page.css.docker compose exec web ./manage.py migrate pages 0002→ The twoLegalPagerows should be deleted; re-runningmigrate pagesshould recreate them with the original seeded copy.Risks & Considerations
LegalPagerows existing. The data migration creates them, but environments that skip migrations or restore from a snapshot taken before0003_create_legal_pagesran will render an empty page. Confirm the migration runs on staging/prod.Last Updatedtimestamp matches the publish date of Wagtail publish date, so it is not the same as2024-02-22from Prod – we need to manually adjust the CMS0003_create_legal_pageswas hand-matched to current prodjc/wagtail-integrationfirst; rebasing this branch ontodevelopbefore that lands will surface unrelated changes.Screenshots
Self-review Checklist
Frontend