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
- Create an empty website with 2 languages - English and German.
- Create a Page with the slug
parent-enin English and publish it, leave the German slug empty. - Create a child Page of the first page with the slug
child-enin English andchild-dein German - Confirm that the created child page has the url
parent-en/child-enand the respective German url, all is fine for now. - Open the parent Page and add a custom German slug, specifically
parent-deand publish all the unpublished pages. - Now open the German version of the website, and see in the menu that the link to the child page is
parent-en/child-deinstead of the correctparent-de/child-deurl. Confirm that the expected urlparent-de/child-deactually 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
- fix a bug about slugs being broken in a multi-lang setup (#6622) — committed to what-digital/django-cms by deleted user 4 years ago
- fix a bug about slugs being broken in a multi-lang setup (#6622) — committed to MacLake/django-cms by deleted user 4 years ago
- Fix #6622 bad Title.path in ML sites if parent slug is created or modified — committed to c2n-dju/django-cms by fp4code 3 years ago
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-helpersThis 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