-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Description
Description
When using a multi-site setup, Django CMS allows to switch the CMS page tree to other sites via the triple-dot menu. When doing this, the key cms_admin_site
is set in the session. Changing the template of a page from a different site (that is open in a different tab) now gives a 404 error.
Steps to reproduce
Steps to reproduce the behavior:
- Open a page on Site A and go into edit mode in tab 1.
- Open the page tree and switch it to site B in tab 2.
- Change the template on the page in tab 1.
- See 404 error.
Expected behaviour
The template change should be saved.
Actual behaviour
A broken message modal pops up with your project's 404 page. It's confusing because the site enabled via cms_admin_site
is not communicated when editing PageContent
.
Additional information (CMS/Python/Django versions)
This happens in CM 5.0.1, Python 3.12, Django 5.2.
The reason is that PageContentAdmin.get_queryset
automatically filters by cms_admin_site
and the get_object
call of the change_template
view goes through get_queryset
. It should probably not filter by site when directly accessing a PageContent
object (site filters are likely only useful for list views in this context). This could be done by adding kwargs
to get_object
and get_queryset
that enables/disables the site filter.
Alternatively, the session mechanism could be removed and the CMS page tree could be filtered explicitly via a site
query parameter instead.
Do you want to help fix this issue?
- Yes, I want to help fix this issue and I will join the channel #pr-reviews on the Discord Server to confirm with the community that a PR is welcome.
- No, I only want to report the issue.