Skip to content

[#2081] Decentralize CMS integration#2084

Draft
pi-sigma wants to merge 7 commits intodevelopfrom
refactor/cms
Draft

[#2081] Decentralize CMS integration#2084
pi-sigma wants to merge 7 commits intodevelopfrom
refactor/cms

Conversation

@pi-sigma
Copy link
Contributor

@pi-sigma pi-sigma commented Dec 31, 2025

Summary

Refactoring of all code related to CMS:

  • CMS integration of existing Django apps is decentralized (moved into the relevant Django apps)
  • Standalone CMS apps and plugins are moved into core
  • Several modules are renamed to reflect the domain (openzaak -> mijn_aanvragen, plans -> mijn_samenwerkingen etc)
  • Old migrations from cms/plugins are preserved because they contain the logic for creating DB tables and are needed on fresh installs. They are moved into _legacy, a new module specifically for code that's only retained for compatibility
  • Add CMS refactoring commits to .git-blame-ignore-revs

Note

When moving plugins out of the old cms module, a choice had to be made how to handle existing DB tables and migrations. I chose a conservative approach: new migrations for the relevant plugins are created, but the original DB tables are preserved, and the plugin models contain references to the original tables. A "transition migration" tells Django that the models have been moved. This means the refactoring is not 100% "clean", but on the other hand: no data migration is needed, and the old migrations are moved out of the way into _legacy.

Issue References

Closes #2081

Checklist

  • CHANGELOG.rst updated

@codecov-commenter
Copy link

codecov-commenter commented Dec 31, 2025

Codecov Report

❌ Patch coverage is 94.00922% with 26 lines in your changes missing coverage. Please review.
✅ Project coverage is 92.59%. Comparing base (a20c3a4) to head (568a6e3).

Files with missing lines Patch % Lines
src/open_inwoner/mijn_aanvragen/cms/cms_plugins.py 64.28% 10 Missing ⚠️
src/open_inwoner/accounts/tests/test_inbox_page.py 33.33% 4 Missing ⚠️
...c/open_inwoner/accounts/tests/test_action_views.py 50.00% 3 Missing ⚠️
...n_inwoner/mijn_aanvragen/cms/views/zaken_plugin.py 62.50% 3 Missing ⚠️
...c/open_inwoner/accounts/cms/mijn_profiel/models.py 90.00% 1 Missing ⚠️
src/open_inwoner/core/apps.py 83.33% 1 Missing ⚠️
...c/open_inwoner/core/cms/cms_plugins/text/models.py 90.90% 1 Missing ⚠️
src/open_inwoner/mijn_aanvragen/clients.py 66.66% 1 Missing ⚠️
src/open_inwoner/mijn_aanvragen/cms/models.py 95.65% 1 Missing ⚠️
src/open_inwoner/mijn_aanvragen/managers.py 50.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #2084      +/-   ##
===========================================
- Coverage    92.74%   92.59%   -0.16%     
===========================================
  Files         1238     1248      +10     
  Lines        48017    47831     -186     
===========================================
- Hits         44535    44289     -246     
- Misses        3482     3542      +60     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@pi-sigma pi-sigma force-pushed the refactor/cms branch 6 times, most recently from 57a12e5 to 86b0c5d Compare December 31, 2025 20:34
@pi-sigma pi-sigma requested a review from swrichards January 5, 2026 08:57
@pi-sigma pi-sigma marked this pull request as ready for review January 6, 2026 14:08
@pi-sigma pi-sigma force-pushed the refactor/cms branch 2 times, most recently from 49a233b to 6ea3da5 Compare January 6, 2026 14:32
@pi-sigma pi-sigma marked this pull request as draft January 6, 2026 15:07
@pi-sigma pi-sigma force-pushed the refactor/cms branch 7 times, most recently from 895ef33 to fe2c214 Compare January 12, 2026 09:29
@pi-sigma pi-sigma marked this pull request as ready for review January 12, 2026 10:00
@pi-sigma pi-sigma marked this pull request as draft January 21, 2026 15:12
@pi-sigma pi-sigma force-pushed the refactor/cms branch 2 times, most recently from 54951c9 to a661b54 Compare January 27, 2026 08:09
The ElasticsearchConfigTest overwrites the settings with an invalid host
for testing purposes. The settings are cached and affect subsequent
tests (depending on the order in which they are run).
This commit restructures the application to improve modularity and clarity:

1. App Renames (use domain language):
   - 'ssd' → 'mijn_uitkeringen'
   - 'plans' → 'mijn_samenwerkingen'
   - 'pdc' → 'onderwerpen'
   - 'openzaak' → 'mijn_aanvragen'

2. CMS Integration Decentralization:
   - Move CMS integrations from centralized cms/ module to respective apps
   - Each app now owns its CMS configuration (mijn_uitkeringen,
     mijn_samenwerkingen, onderwerpen, mijn_aanvragen, accounts)
   - Standalone CMS apps (banner, footer, extensions) moved to core

3. Code Organization:
   - Flatten core/cms/plugins/ directory structure
   - Move shared CMS utilities (context processors, helpers) to core
   - Consolidate inbox and profile CMS apps under accounts

The changes are purely structural (file movements, renaming). No migrations,
and no changes to database schemas.
CMS plugin models have been moved to new Django apps (core plugins,
mijn_aanvragen_cms, and profile), but we maintain the legacy 'plugins'
app_label to prevent ContentType duplication.

Django automatically creates new ContentType instances when app labels
change, which would break existing GenericForeignKey references (in
FeedItemData and TimelineLog). By keeping app_label='plugins', we avoid
this issue and maintain compatibility with existing data.

Affected models (8 total):
    - LinkPluginConfig, LinkConfig (→ link_plugin)
    - TextPluginConfig (→ text_plugin)
    - UserFeedPluginConfig (→ userfeed_plugin)
    - VideoPlayerPluginConfig (→ videoplayer_plugin)
    - TakenPluginConfig, ZakenPluginConfig (→ mijn_aanvragen_cms)
    - UserAppointments (→ profile)

The goal is safe deployment without data migration. Natural app labels
can be adopted later with proper ContentType migration.
Move old CMS plugin migrations (0001-0012) to _legacy/cms/plugins/ folder
to establish a legacy app that will continue managing plugin models.

The legacy 'plugins' app preserves migration history for database tables
created by migrations 0001-0012. All plugin models continue to be managed
by this app (with app_label='plugins') to prevent ContentType duplication.

Models managed by legacy plugins app (8 total):
    - VideoPlayerPluginConfig
    - UserFeedPluginConfig
    - TextPluginConfig
    - LinkPluginConfig
    - LinkConfig
    - UserAppointments
    - TakenPluginConfig
    - ZakenPluginConfig

Model code is organized in separate directories, but migrations remain
centralized in _legacy/cms/plugins/. A follow-up migration would be
needed to use natural app labels and have the migrations managed by the
apps themselves.
CMS templates are moved to their app template folders, and template
names are updated to be uniform and recognizable (e.g.
'status_inner.html' -> 'aanvragen_detail.html') for the mijn_aanvragen
detail template.

The tempate which overrides Django's default flatpage template
(flatpages/default.html) is deleted because it is no longer used
(flatpages have been migrated to CMS).
@pi-sigma pi-sigma marked this pull request as ready for review January 27, 2026 10:21
@pi-sigma pi-sigma marked this pull request as draft February 2, 2026 09: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.

Refactor CMS packages to match domain language

2 participants