Copying and pasting a page or parts of the page tree only reflects currently published pages. Trying to view a copied page leads to Version matching query does not exist.exception.
Description
Steps to reproduce
Steps:
Start from empty project with ./manage.py migrate, ./manage.py createsuperuser, and ./manage.py runserver
Go to localhost:8000/admin and log in.
Create new page content (e.g., test)
Publish that page.
Create another new page content (e.g., unpublished) and do not publish it.
Copy all pages from the global burger menu in the page tree
Paste the pages either from the global burger menu or from the page’s burger menu.
Expected behaviour
As an editor I will expect the page content objects to be copied that I am working with. IMHO this would be the first existing version in this order:
Latest draft
Published
Latest unpublished
The copied page should appear in the page tree as draft versions.
Actual behaviour
Only the published page is copied.
There is no PageContent object created for the unpublished page.
When trying to view the copied page an exception is raised.
Additional information (CMS/Python/Django versions)
Django 3.2.12
django-cms@develop-4
djangocms-text-ckeditor@support/4.0.x
djangocms-versioning@master
Do you want to help fix this issue?
[X] Yes, I want to help fix this issue and I will join #workgroup-pr-review on Slack to confirm with the community that a PR is welcome.
[ ] No, I only want to report the issue.
At first sight this might be deep rooted issue. I would assume it comes from monkey patching the model manager of the PageContent object. There potentially are design decisions to be taken:
The Page models copies self.pagecontent_set.all() which evaluates to an empty query set if djangocms-versioning is installed and the page is not published. Apparently versioning monkey patches the way pagecontent_set is evaluated and only reflects published pages (in its managers.py).
Copying and pasting a page or parts of the page tree only reflects currently published pages. Trying to view a copied page leads to
Version matching query does not exist.
exception.Description
Steps to reproduce
Steps:
./manage.py migrate
,./manage.py createsuperuser
, and./manage.py runserver
localhost:8000/admin
and log in.Expected behaviour
As an editor I will expect the page content objects to be copied that I am working with. IMHO this would be the first existing version in this order:
The copied page should appear in the page tree as draft versions.
Actual behaviour
PageContent
object created for the unpublished page.Screenshots
This issue is part of https://github.com/django-cms/django-cms/issues/7400 which cannot be fixed within the core.
Additional information (CMS/Python/Django versions)
Do you want to help fix this issue?
At first sight this might be deep rooted issue. I would assume it comes from monkey patching the model manager of the
PageContent
object. There potentially are design decisions to be taken:The Page models copies
self.pagecontent_set.all()
which evaluates to an empty query set if djangocms-versioning is installed and the page is not published. Apparently versioning monkey patches the way pagecontent_set is evaluated and only reflects published pages (in itsmanagers.py
).