New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Page cache key doesn't depend on language #6607

sephii opened this Issue Feb 2, 2019 · 1 comment


None yet
1 participant
Copy link

sephii commented Feb 2, 2019


The docs for the CMS_PAGE_CACHE setting mention that the language is used to build the cache key:

Should the output of pages be cached? Takes the language, and time zone into account. Pages for logged in users are not cached. If the toolbar is visible the page is not cached as well.

The _page_cache_key function relies on request.get_full_path() to add the language to the cache key. However there are cases where the language is not in the path. For example you could create your own middleware that sets the language depending on the hostname, instead of the path (which is my case).

I think just adding translation.get_language() to the key would do the trick without any side effect.

Expected behaviour

The cache includes the current active language instead of relying of the language being in the URL.

Actual behaviour

The cache relies on the language being part of the URL.


  • Python version: N/A
  • Django version: 2.0
  • django CMS version: 3.6

@sephii sephii changed the title Page cache doesn't depend on language Page cache key doesn't depend on language Feb 2, 2019

sephii added a commit to sephii/django-cms that referenced this issue Feb 2, 2019


This comment has been minimized.

Copy link
Contributor Author

sephii commented Feb 2, 2019

I made a fix here. I'd be happy to submit it as a PR but I guess I should write a test first. I'll do it when I have more time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment