Skip to content

fix: route the CMS catch-all through i18n_patterns#21

Merged
fsbraun merged 1 commit into
5.1from
fix/cms-urls-i18n-patterns
Jun 15, 2026
Merged

fix: route the CMS catch-all through i18n_patterns#21
fsbraun merged 1 commit into
5.1from
fix/cms-urls-i18n-patterns

Conversation

@fsbraun

@fsbraun fsbraun commented Jun 15, 2026

Copy link
Copy Markdown
Member

Problem

djangocms . (the simplified installer that adds django CMS to an existing project, in django-cms#feat/simplified-project-creation) reads djangocms_install_rules.json from this repo and inserts path("", include("cms.urls")) into the project's urls.py. It was always appended to the plain urlpatterns list.

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():

urlpatterns += i18n_patterns(
    path("", include("cms.urls")),  # must be language-prefixed
)

Change

  • Mark the CMS catch-all url rule with "i18n": true. The installer uses this to route the pattern through a urlpatterns += i18n_patterns(...) block when the project's urls.py already uses i18n_patterns — otherwise it falls back to the plain urlpatterns list (unchanged behaviour). Non-i18n routes (the headless djangocms_rest API) stay in the plain list.
  • Document the flag in the rules comment.
  • Add i18n (optional boolean) to urlRule in djangocms_install_rules.schema.v1.json. The schema uses additionalProperties: false, so without this the rules file would fail validation.

The matching installer-side change (the update_urls logic that honours this flag, plus tests) lands in the django-cms repo on feat/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.json passes jsonschema validation against the updated schema.

🤖 Generated with Claude Code

`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>
@fsbraun fsbraun merged commit ef16afd into 5.1 Jun 15, 2026
10 checks passed
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.

1 participant