-
Notifications
You must be signed in to change notification settings - Fork 30
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 the django CMS core #300
Conversation
Codecov Report
@@ Coverage Diff @@
## master #300 +/- ##
==========================================
+ Coverage 88.68% 89.75% +1.06%
==========================================
Files 76 67 -9
Lines 2334 2196 -138
Branches 298 293 -5
==========================================
- Hits 2070 1971 -99
+ Misses 203 170 -33
+ Partials 61 55 -6
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
This pull request introduces 1 alert when merging 02ceb4b into 31f14df - view on LGTM.com new alerts:
Heads-up: LGTM.com's PR analysis will be disabled on the 5th of December, and LGTM.com will be shut down ⏻ completely on the 16th of December 2022. It looks like GitHub code scanning with CodeQL is already set up for this repo, so no further action is needed 🚀. For more information, please check out our post on the GitHub blog. |
# Conflicts: # djangocms_versioning/monkeypatch/extensions.py # djangocms_versioning/monkeypatch/page.py # tests/test_integration_with_core.py
add tests for current_content_iterator
…ve-patching # Conflicts: # djangocms_versioning/cms_config.py # djangocms_versioning/monkeypatch/templatetags.py # tests/requirements/requirements_base.txt # tests/test_integration_with_core.py
Description
Patching easily introduces side-effects, especially if patches happen at diverse places in the code base. This PR removes all patches to the django CMS core.
Mixin for CMSToolbar using django CMS new config option to provide a mixin for the
cms.toolbar.toolbar.CMSToolbar
class.See this PR.
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 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.Since the
Version
model requires aUser
object the following syntax has been introduced:The
with_user()
statement tells versioning which user the first version of that object will be assigned to and also automatically creates aVersion
object.If the
with_user()
statement is missing, djangocms-verisoning will issue a warning and not create aVersion
object. It will not raise an exception to stay backwards compatible.Patches to
PageContentAdmin
These patches have been moved to the already existing
VersioningCMSPageAdminMixin
where they belong.Patches to
PageExtension
andPageContentExtension
These can be handled by allowing to already used signals to forward changes to the extension objects to the extended objects.
Performance/feature patches
Patches which are not related to versioning functionality have been moved to the core with this PR.
Changes to Django's ORM
Versioning introduces changes to Django's handling of versioned models. These changes are, of course, retained:
PageContent
modelCompatibility
This PR will not work with versions 4.0.x of django cms since they do not offer the CMSToolbar configuration.
Related resources
Checklist
master
Slack to find a “pr review buddy” who is going to review my pull request.