fix: route the CMS catch-all through i18n_patterns#21
Merged
Conversation
`djangocms .` inserts `path("", include("cms.urls"))` into urls.py when
adding django CMS to an existing project. It was always appended to the
plain `urlpatterns` list, which strips the language prefix from CMS pages
and contradicts the documented manual installation.
Mark the CMS catch-all rule with `"i18n": true` so the installer routes it
through `i18n_patterns()` when the project's urls.py already uses
i18n_patterns (otherwise it stays in the plain list). Document the flag in
the rules comment and add it to the JSON schema's urlRule (which uses
additionalProperties: false, so the property must be declared).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
Problem
djangocms .(the simplified installer that adds django CMS to an existing project, in django-cms#feat/simplified-project-creation) readsdjangocms_install_rules.jsonfrom this repo and insertspath("", include("cms.urls"))into the project'surls.py. It was always appended to the plainurlpatternslist.That strips the language prefix from CMS pages and directly contradicts the documented manual installation, which requires the CMS catch-all to live inside
i18n_patterns():Change
"i18n": true. The installer uses this to route the pattern through aurlpatterns += i18n_patterns(...)block when the project'surls.pyalready usesi18n_patterns— otherwise it falls back to the plainurlpatternslist (unchanged behaviour). Non-i18n routes (the headlessdjangocms_restAPI) stay in the plain list.comment.i18n(optional boolean) tourlRuleindjangocms_install_rules.schema.v1.json. The schema usesadditionalProperties: false, so without this the rules file would fail validation.The matching installer-side change (the
update_urlslogic that honours this flag, plus tests) lands in the django-cms repo onfeat/simplified-project-creation. This PR is the data/schema half so a successful remote fetch doesn't override the bundled flag.Validated: both JSON files parse and
djangocms_install_rules.jsonpassesjsonschemavalidation against the updated schema.🤖 Generated with Claude Code