Skip to content
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

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 #6622

Open
victor-yunenko opened this Issue Feb 25, 2019 · 3 comments

Comments

Projects
None yet
3 participants
@victor-yunenko
Copy link

victor-yunenko commented Feb 25, 2019

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.

@victor-yunenko victor-yunenko changed the title The slugs of child pages are breaking when a user adds a custom slug for another language of the parent page 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 Feb 25, 2019

@christian-schneider

This comment has been minimized.

Copy link

christian-schneider commented Mar 11, 2019

I just experienced the same issue on a 3.5.3 installation. Glad I found this report, was quite worried for a moment ;)

@Foobartender

This comment has been minimized.

Copy link

Foobartender commented Mar 14, 2019

A prerequisite for reproducing this is that at least one of the parent's (i.e. parent-(en|de)) ancestors (including the root page) does not have a German translation. If all pages in the chain have a German translation, it works fine.

If a translation in the chain is unpublished, all children of the page will show a tooltip "unpublished parent" in the page tree view for the publish icon of the translation.

I also have a page with a CMSApp hook and a CMSAttachMenu only in English. The CMSAttachMenu will raise NoReverseMatch errors if another language is selected, presumably because the urlpatterns have not been loaded.

So, I'd guess the fallback mechanism isn't working properly (I have configured fallbacks in CMS_LANGUAGES).

@Foobartender

This comment has been minimized.

Copy link

Foobartender commented Mar 18, 2019

cms.models.pagemodel.mark_descendants_as_published() updates the paths of the published titles of its children:
unpublished_public.exclude(has_url_overwrite=True).update(path=new_path)

I think it should update all titles of its children:
Title.objects.filter(language=language, page__in=page_children, has_url_overwrite=False).update(path=new_path)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.