Remove LeadershipPage Model [WT-1389]#17266
Draft
stephaniehobson wants to merge 1 commit into
Draft
Conversation
stevejalim
approved these changes
Jul 1, 2026
stevejalim
left a comment
Contributor
There was a problem hiding this comment.
LGTM - thanks. Let's wait to merge this until we can ship it as a single-changeset release
Contributor
There was a problem hiding this comment.
Pull request overview
Removes the retired Wagtail LeadershipPage model and legacy leadership StreamField block implementations from mozorg, and adds migrations to drop the model plus clean up the associated django_content_type row to prevent Wagtail admin lookups from failing.
Changes:
- Remove
LeadershipPagefrombedrock/mozorg/models.py. - Remove legacy leadership page block definitions from
bedrock/mozorg/blocks/leadership.py, leaving only the snippet-based blocks. - Add migrations to delete the
LeadershipPagemodel and to purge the staledjango_content_typeentry.
Note: Review performed following the repository’s custom Copilot instructions.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| bedrock/mozorg/models.py | Removes the retired LeadershipPage model definition and its use of LeadershipSectionBlock. |
| bedrock/mozorg/blocks/leadership.py | Deletes legacy page-specific leadership blocks, keeping snippet-based blocks used elsewhere. |
| bedrock/mozorg/migrations/0043_delete_leadershippage.py | Schema migration deleting the LeadershipPage model. |
| bedrock/mozorg/migrations/0044_delete_leadershippage_contentmodels.py | Data migration intended to delete the stale django_content_type row for the removed model. |
Comment on lines
+7
to
+18
| STALE_MODELS = ( | ||
| "LeadershipPage", | ||
| ) | ||
|
|
||
|
|
||
| def remove_stale_contenttypes(apps, schema_editor): | ||
| # Migration 0043 dropped LeadershipPage | ||
| # but Django doesn't auto-purge the django_content_type rows for deleted models. Anything | ||
| # that resolves a log entry / permission via ContentType.get_object_for_this_type() (e.g. | ||
| # the Wagtail admin home recent-edits panel) then crashes because model_class() is None. | ||
| ContentType = apps.get_model("contenttypes", "ContentType") | ||
| ContentType.objects.filter(app_label="cms", model__in=STALE_MODELS).delete() |
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.
One-line summary
Removes the retired LeadershipPage model and block and deletes them from the content table.
Significant changes and points to review
Issue / Bugzilla link
[WT-1389]
Testing
NOTE: this PR depends on #17253