Skip to content

Commit

Permalink
fix uniweb-issue-1353: attempt to remove missing item from list (#439)
Browse files Browse the repository at this point in the history
* fix uniweb-issue-1353: attempt to remove missing item from list

* fix: Linting issue in admin.py

* fix: ruff linting issue in factories.py

* fix: ruff linting issue in test_admin.py

---------

Co-authored-by: Fabian Braun <[email protected]>
  • Loading branch information
jrief and fsbraun authored Jan 7, 2025
1 parent c9bf9f4 commit df01223
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion djangocms_versioning/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion djangocms_versioning/cms_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion djangocms_versioning/test_utils/factories.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion tests/test_admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit df01223

Please sign in to comment.