django-cms: The slugs of child pages are built incorrectly and return a 404 error when a user adds a custom slug for another language of the parent page

Summary

The slugs of child pages are breaking when a user adds a custom slug for another language of the parent page, this leads to incorrect urls being displayed and the correct urls return a 404 error.

Actual behaviour

  1. Create an empty website with 2 languages - English and German.
  2. Create a Page with the slug parent-en in English and publish it, leave the German slug empty.
  3. Create a child Page of the first page with the slug child-en in English and child-de in German
  4. Confirm that the created child page has the url parent-en/child-en and the respective German url, all is fine for now.
  5. Open the parent Page and add a custom German slug, specifically parent-de and publish all the unpublished pages.
  6. Now open the German version of the website, and see in the menu that the link to the child page is parent-en/child-de instead of the correct parent-de/child-de url. Confirm that the expected url parent-de/child-de actually returns a 404 error.

Expected behaviour

On the 6th the url in the menu should be parent-de/child-de , and the url parent-de/child-de shouldn’t return a 404 error.

Environment

  • the first one

    • Python version: 3.5.3
    • Django version: 1.11.20
    • django CMS version: 3.6.0
  • the second one

    • Python version: 2.7.6
    • Django version: 1.9.5
    • django CMS version: 3.5.1

The issue doesn’t appear to be present in django-cms 3.4.5 though.

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 8
  • Comments: 22 (7 by maintainers)

Commits related to this issue

Most upvoted comments

Facing almost same issue. If a parent page gets translated after child-pages exists, the translated slug is set incorrectly in the path of all child-pages. So there is a mixup in the url of 2 languages.

Manual fix: Move the parent page (with all children) to another place in the page tree and then move it back again. Then all paths (urls) get updated.

By the way here’s a temporary fix that I’m adding to my projects for the time being:

https://gitlab.com/what-digital/djangocms-helpers/-/blob/master/djangocms_helpers/fixes/language_slug_fix.py

It’s also available on pypi as djangocms-helpers

This bug is still present in 3.6.0, I assume upgrade to 3.7.2 to work around this is useless?

This bug is still present in 3.6.0, I assume upgrade to 3.7.2 to work around this is useless?

It is still present in 3.7.1