diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 5bdd54e5..b11ccd55 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -10,10 +10,10 @@ jobs: strategy: fail-fast: false matrix: - python-version: [ 3.7, 3.8, 3.9 ] # latest release minus two + python-version: [ 3.9, 3.10, 3.11, 3.12 ] # latest release minus two requirements-file: [ - dj22_cms40.txt, - dj32_cms40.txt, + django-3.2.txt, + django-4.2.txt, ] os: [ ubuntu-20.04, diff --git a/djangocms_moderation/admin.py b/djangocms_moderation/admin.py index 460bb8ee..c690b857 100644 --- a/djangocms_moderation/admin.py +++ b/djangocms_moderation/admin.py @@ -16,7 +16,7 @@ from cms.toolbar.utils import get_object_preview_url from cms.utils.helpers import is_editable_model -from adminsortable2.admin import SortableInlineAdminMixin +from adminsortable2.admin import SortableInlineAdminMixin, SortableAdminBase from treebeard.admin import TreeAdmin from . import constants, signals @@ -990,7 +990,7 @@ def get_extra(self, request, obj=None, **kwargs): return 1 -class WorkflowAdmin(admin.ModelAdmin): +class WorkflowAdmin(SortableAdminBase, admin.ModelAdmin): inlines = [WorkflowStepInline] list_display = ["name", "is_default"] fields = [ diff --git a/djangocms_moderation/contrib/__init__.py b/djangocms_moderation/contrib/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/djangocms_moderation/contrib/moderation_forms/__init__.py b/djangocms_moderation/contrib/moderation_forms/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/djangocms_moderation/contrib/moderation_forms/cms_plugins.py b/djangocms_moderation/contrib/moderation_forms/cms_plugins.py deleted file mode 100644 index 61e23625..00000000 --- a/djangocms_moderation/contrib/moderation_forms/cms_plugins.py +++ /dev/null @@ -1,32 +0,0 @@ -from django.utils.translation import gettext_lazy as _ - -from cms.plugin_pool import plugin_pool - -from aldryn_forms.cms_plugins import FormPlugin - -from djangocms_moderation.helpers import get_page_or_404 -from djangocms_moderation.signals import confirmation_form_submission - -from .models import ModerationForm - - -class ModerationFormPlugin(FormPlugin): - name = _("Moderation Form") - model = ModerationForm - fieldsets = ((None, {"fields": ("name",)}),) - - def form_valid(self, instance, request, form): - fields = form.get_serialized_fields(is_confirmation=False) - fields_as_dicts = [field._asdict() for field in fields] - page = get_page_or_404(request.GET.get("page"), request.GET.get("language")) - - confirmation_form_submission.send( - sender=self.__class__, - page=page, - language=request.GET.get("language"), - user=request.user, - form_data=fields_as_dicts, - ) - - -plugin_pool.register_plugin(ModerationFormPlugin) diff --git a/djangocms_moderation/contrib/moderation_forms/migrations/0001_initial.py b/djangocms_moderation/contrib/moderation_forms/migrations/0001_initial.py deleted file mode 100644 index c2ab629c..00000000 --- a/djangocms_moderation/contrib/moderation_forms/migrations/0001_initial.py +++ /dev/null @@ -1,23 +0,0 @@ -# Generated by Django 1.11.12 on 2018-05-03 09:15 -from django.db import migrations - - -class Migration(migrations.Migration): - - initial = True - - dependencies = [("aldryn_forms", "0011_auto_20180110_1300")] - - operations = [ - migrations.CreateModel( - name="ModerationForm", - fields=[], - options={ - "verbose_name": "Moderation Form", - "verbose_name_plural": "Moderation Forms", - "proxy": True, - "indexes": [], - }, - bases=("aldryn_forms.formplugin",), - ) - ] diff --git a/djangocms_moderation/contrib/moderation_forms/migrations/__init__.py b/djangocms_moderation/contrib/moderation_forms/migrations/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/djangocms_moderation/contrib/moderation_forms/models.py b/djangocms_moderation/contrib/moderation_forms/models.py deleted file mode 100644 index 72027ccd..00000000 --- a/djangocms_moderation/contrib/moderation_forms/models.py +++ /dev/null @@ -1,10 +0,0 @@ -from django.utils.translation import gettext_lazy as _ - -from aldryn_forms.models import FormPlugin - - -class ModerationForm(FormPlugin): - class Meta: - proxy = True - verbose_name = _("Moderation Form") - verbose_name_plural = _("Moderation Forms") diff --git a/djangocms_moderation/views.py b/djangocms_moderation/views.py index 03f899e3..bab4d071 100644 --- a/djangocms_moderation/views.py +++ b/djangocms_moderation/views.py @@ -6,7 +6,7 @@ from django.shortcuts import get_object_or_404, render from django.urls import reverse from django.utils.decorators import method_decorator -from django.utils.http import is_safe_url +from django.utils.http import url_has_allowed_host_and_scheme from django.utils.translation import gettext_lazy as _, ngettext from django.views.generic import FormView @@ -83,7 +83,7 @@ def _get_success_redirect(self): """ return_to_url = self.request.GET.get("return_to_url") if return_to_url: - url_is_safe = is_safe_url( + url_is_safe = url_has_allowed_host_and_scheme( url=return_to_url, allowed_hosts=self.request.get_host(), require_https=self.request.is_secure(), diff --git a/setup.py b/setup.py index 86e47922..4b9f2171 100644 --- a/setup.py +++ b/setup.py @@ -10,8 +10,8 @@ "django-admin-sortable2>=0.6.4", ] DEPENDENCY_LINKS = [ - "https://github.com/django-cms/django-cms/tarball/release/4.0.1.x#egg=django-cms", - "https://github.com/django-cms/djangocms-versioning/tarball/1.2.2#egg=djangocms-versioning", + "django-cms>=4.1.0", + "djangocms-versioning>=2.0.0", ] setup( diff --git a/tests/requirements/dj22_cms40.txt b/tests/requirements/dj22_cms40.txt deleted file mode 100644 index 4e51203c..00000000 --- a/tests/requirements/dj22_cms40.txt +++ /dev/null @@ -1,6 +0,0 @@ --r ./requirements_base.txt - -Django>=2.2,<3.0 - -django-admin-sortable2<1.0 -django_polymorphic==2.0.3 diff --git a/tests/requirements/dj32_cms40.txt b/tests/requirements/django-3.2.txt similarity index 100% rename from tests/requirements/dj32_cms40.txt rename to tests/requirements/django-3.2.txt diff --git a/tests/requirements/django-4.2.txt b/tests/requirements/django-4.2.txt new file mode 100644 index 00000000..1a34a38b --- /dev/null +++ b/tests/requirements/django-4.2.txt @@ -0,0 +1,6 @@ +-r ./requirements_base.txt + +Django>=4.2,<5.0 + +django-admin-sortable2 +django_polymorphic diff --git a/tests/requirements/requirements_base.txt b/tests/requirements/requirements_base.txt index 0c3d55fa..070bbd28 100644 --- a/tests/requirements/requirements_base.txt +++ b/tests/requirements/requirements_base.txt @@ -1,7 +1,6 @@ -aldryn-forms cachetools coverage -django-classy-tags +django-classy-tags>=0.7.2 django-filer django-sekizai django-simple-captcha @@ -13,9 +12,8 @@ mock pyflakes>=2.1.1 python-dateutil>=2.4 -# Unreleased django-cms 4.0 compatible packages -https://github.com/django-cms/django-cms/tarball/release/4.0.1.x#egg=django-cms -https://github.com/django-cms/djangocms-text-ckeditor/tarball/support/4.0.x#egg=djangocms-text-ckeditor -https://github.com/django-cms/djangocms-versioning/tarball/1.2.2#egg=djangocms-versioning -https://github.com/FidelityInternational/djangocms-version-locking/tarball/1.2.0#egg=djangocms-version-locking -https://github.com/django-cms/djangocms-alias/tarball/support/django-cms-4.0.x#egg=djangocms-alias +# django-cms 4.0 specific packages +django-cms>=4.1.0 +djangocms-text-ckeditor>=5.1.2 +djangocms-alias>=2.0.0 +djangocms-versioning>=2.0.0 diff --git a/tests/settings.py b/tests/settings.py index c016c9f2..4e99428b 100644 --- a/tests/settings.py +++ b/tests/settings.py @@ -4,9 +4,7 @@ "tests.utils.app_1", "tests.utils.app_2", "djangocms_versioning", - "djangocms_version_locking", # the following 4 apps are related - "aldryn_forms", "filer", "easy_thumbnails", "captcha", @@ -15,6 +13,7 @@ "tests.utils.moderated_polls", "tests.utils.versioned_none_moderated_app", ], + "CMS_CONFIRM_VERSION4": True, # As advised, we can disable migrations in tests. This will improve # test performance and removes the need for test apps to provide migrations "MIGRATION_MODULES": { @@ -23,10 +22,9 @@ "menus": None, "djangocms_alias": None, "djangocms_versioning": None, - "djangocms_version_locking": None, "filer": None, "djangocms_moderation": None, - "aldryn_forms": None, + "djangocms_text_ckeditor": None, }, "DEFAULT_AUTO_FIELD": "django.db.models.AutoField", }