django-cms / djangocms-moderation

Other
13 stars 20 forks source link

feat: Django 4.2 support #262

Closed fsbraun closed 3 months ago

fsbraun commented 3 months ago

Description

This PR updates djangocms-moderation to support Django 4.2 and 5.0. It is based on the ideas and work of #256 by @Aiky30 .

Related resources

Checklist

joshyu commented 3 months ago

@fsbraun , I create a PR https://github.com/django-cms/djangocms-moderation/pull/263 it fixes all check errors and failed tests.

joshyu commented 3 months ago

@fsbraun , about the failed pre-commit-config issue, It is related to the version of isort and other pre-commit plugins.

Freeman and I ever met this errors while fixing another repo.

refer to this: https://stackoverflow.com/questions/75269700/pre-commit-fails-to-install-isort-5-11-4-with-error-runtimeerror-the-poetry-co

joshyu commented 3 months ago

@fsbraun ,

about the failed tests, it is because that djangocms-version-locking addon create a monkeypatch to override djangocms-moderation.models.ModerationCollection._add_nested_children method, it add a logic to check whether this version is locked. If locked, current children plugins will not be added to the current collection.

I didn't find when versionlock field in version instance is set, so I hard-code the version check and give the different return value.

fsbraun commented 3 months ago

@joshyu Thanks for the explanation. To me, this is very helpful: So that actually is a desired behavior. I also understand https://github.com/FidelityInternational/djangocms-version-locking/issues/80 now (an issue @marksweb raised a while ago)... Let me look into this, maybe we can identical results for CMS 4.0 and CMS 4.1 😃

joshyu commented 3 months ago

@fsbraun, need your help to fix the left pre-commit error about 0001_squashed_0017_auto_20220831_0727.py file

fsbraun commented 3 months ago

@joshyu Pre-commit now passes. I'd like to look into the version locking effect on the collections with djangocms-versioning 2. Probably need today. Sufficient for you?

fsbraun commented 3 months ago

@joshyu I've updated the tests to test the same outcomes for djangocms-versioning 1 and 2. For most tests that means, removing the version lock before the test. I've also added a test that ensures that locked versions are not added to collections. If you're ok, I can merge.

joshyu commented 3 months ago

@fsbraun , LGTM. Thank you for giving such a perfect solution, this is really better than my update on test_view.py. please help to merge it.

Thanks.