-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
fix: Remove patching of PageContent by djangocms-versioning #7446
Conversation
# Conflicts: # cms/api.py # cms/extensions/admin.py # cms/extensions/extension_pool.py # cms/models/pagemodel.py # cms/templatetags/cms_admin.py # menus/menu_pool.py
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Surprisingly a lot of old references to draft still in places. Well found.
Some comments, 2 of any concern:
Page content creation user
Removal of force language, could be replaced / the original requirement sourced back to the wizard changes.
Co-authored-by: Andrew Aikman <Aiky30@users.noreply.github.com>
Co-authored-by: Andrew Aikman <Aiky30@users.noreply.github.com>
Co-authored-by: Andrew Aikman <Aiky30@users.noreply.github.com>
Fix: flake8 line length
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Read through it thoroughly once again. Nice to have a proper solution to the patching finally.
Description
Patching easily introduces side-effects, especially if patches happen at diverse places in the code base. This PR removes the need for djangocms-versioning to patch the core.
Additional interface through CMSConfig
The toolbar is at the heart of django CMS. This PR allows apps to register a mixin for the
cms.toolbar.toolbar.CMSToolbar
class. All it has to do is to setdjangocms-versioning (and other apps) can use this config instead of patching
CMSToolbar
. (Example for other use cases: Change the login process through the toolbar)Creating
Version
instances when a versioned model is createdSo far, djangocms-versioning puts the burden of creating
Version
objects for versioned models on the app owning the versioned models. To keep the core agnostic of versioning capabilities. This PR (django-cms/djangocms-versioning#300) lets djangocms-versioning automatically create a draftVersion
object as soon as a versioned object is created. This is achieved by modifying the versioned model's manager'screate
method.This removes the need to patch the creation of
PageContent
objects.Patches independent of versioning
Quite a few patches of djangocms-versioning are not connected to the versioning capability. They typically are improvement of the core and have been moved into the core with this PR.
Ability to "see" unpublished
PageContent
objectsA number of patches by djangocms-versioning enable to core to see unpublished
PageContent
objects. An example are the Page wizards which need to be able to access newly created PageContent objects. This is done by using the Django manager_base_manager
in these selected cases.Related resources
Checklist
develop-4