From 4fb112c7de3195466c3b67f5787dd59c1e801e9c Mon Sep 17 00:00:00 2001 From: Jacob Rief Date: Mon, 23 Dec 2024 13:45:38 +0100 Subject: [PATCH 1/4] fix uniweb-issue-1353: attempt to remove missing item from list --- djangocms_versioning/cms_config.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/djangocms_versioning/cms_config.py b/djangocms_versioning/cms_config.py index ae864f2b..d1a7bfa4 100644 --- a/djangocms_versioning/cms_config.py +++ b/djangocms_versioning/cms_config.py @@ -279,7 +279,7 @@ def get_readonly_fields(self, request, obj=None): if form.fieldsets: fields = flatten_fieldsets(form.fieldsets) fields = list(fields) - for f_name in ["slug", "overwrite_url"]: + for f_name in {"slug", "overwrite_url"}.intersection(fields): fields.remove(f_name) return fields From 3e6a49797b291c260badc9b08072303ab11b8c67 Mon Sep 17 00:00:00 2001 From: Fabian Braun Date: Tue, 7 Jan 2025 11:51:39 +0100 Subject: [PATCH 2/4] fix: Linting issue in admin.py --- djangocms_versioning/admin.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/djangocms_versioning/admin.py b/djangocms_versioning/admin.py index 223d3e9e..d24262d6 100644 --- a/djangocms_versioning/admin.py +++ b/djangocms_versioning/admin.py @@ -916,7 +916,7 @@ def compare_versions(self, request, queryset): f"admin:{self.model._meta.app_label}_{self.model._meta.model_name}_compare", args=(queryset[0].pk,), ) - url += "?compare_to=%d" % queryset[1].pk + url += f"?compare_to={queryset[1].pk}" return redirect(url) From fa7536803787f1987067569b657305570d153641 Mon Sep 17 00:00:00 2001 From: Fabian Braun Date: Tue, 7 Jan 2025 11:55:33 +0100 Subject: [PATCH 3/4] fix: ruff linting issue in factories.py --- djangocms_versioning/test_utils/factories.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/djangocms_versioning/test_utils/factories.py b/djangocms_versioning/test_utils/factories.py index 2eb97417..d76f786c 100644 --- a/djangocms_versioning/test_utils/factories.py +++ b/djangocms_versioning/test_utils/factories.py @@ -104,7 +104,7 @@ def version(self, create, extracted, **kwargs): class AnswerFactory(factory.django.DjangoModelFactory): poll_content = factory.SubFactory(PollContentFactory) text = factory.LazyAttributeSequence( - lambda o, n: "Poll %s - Answer %d" % (o.poll_content.poll.name, n) + lambda o, n: f"Poll {o.poll_content.poll.name} - Answer {n}" ) class Meta: From e4c1f1f9e8d33c2cbb6c9b581f12b54b23eac29f Mon Sep 17 00:00:00 2001 From: Fabian Braun Date: Tue, 7 Jan 2025 11:57:19 +0100 Subject: [PATCH 4/4] fix: ruff linting issue in test_admin.py --- tests/test_admin.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_admin.py b/tests/test_admin.py index 551007fd..2997116a 100644 --- a/tests/test_admin.py +++ b/tests/test_admin.py @@ -2156,7 +2156,7 @@ def test_compare_view_has_version_data_in_context_when_version2_in_get_param(sel url = self.get_admin_url( self.versionable.version_model_proxy, "compare", versions[0].pk ) - url += "?compare_to=%d" % versions[1].pk + url += f"?compare_to={versions[1].pk}" user = self.get_staff_user_with_no_permissions() with self.login_user_context(user):