Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork3.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 keycms_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 viacms_admin_site
is not communicated when editingPageContent
.
Additional information (CMS/Python/Django versions)
This happens in CM 5.0.1, Python 3.12, Django 5.2.
The reason is thatPageContentAdmin.get_queryset
automatically filters bycms_admin_site
and theget_object
call of thechange_template
view goes throughget_queryset
. It should probably not filter by site when directly accessing aPageContent
object (site filters are likely only useful for list views in this context). This could be done by addingkwargs
toget_object
andget_queryset
that enables/disables the site filter.
Alternatively, the session mechanism could be removed and the CMS page tree could be filtered explicitly via asite
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 onthe Discord Server to confirm with the community that a PR is welcome.
- No, I only want to report the issue.