From fcfbcdf685c0a5b6c4eef04089d7860c674ed200 Mon Sep 17 00:00:00 2001 From: Fabian Braun Date: Sat, 26 Oct 2024 01:35:04 +0200 Subject: [PATCH] Fix linting issues --- djangocms_link/fields.py | 7 ++++--- tests/test_plugins.py | 6 +++--- tests/test_validators.py | 2 +- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/djangocms_link/fields.py b/djangocms_link/fields.py index ee6e20ec..7fa16d8e 100644 --- a/djangocms_link/fields.py +++ b/djangocms_link/fields.py @@ -5,8 +5,8 @@ from django.contrib.admin import site from django.contrib.admin.widgets import SELECT2_TRANSLATIONS, AutocompleteSelect from django.contrib.sites.models import Site -from django.db.models import JSONField, ManyToOneRel, ForeignKey, SET_NULL -from django.forms import Field, MultiWidget, Select, TextInput, URLInput, CheckboxInput +from django.db.models import JSONField, ManyToOneRel +from django.forms import Field, MultiWidget, Select, TextInput, URLInput from django.utils.translation import get_language from django.utils.translation import gettext_lazy as _ @@ -151,6 +151,7 @@ class LinkWidget(MultiWidget): template_name = "djangocms_link/admin/link_widget.html" data_pos = {} number_sites = None + class Media: js = ("djangocms_link/link-widget.js",) css = {"all": ("djangocms_link/link-widget.css",)} @@ -172,7 +173,7 @@ def __init__(self): attrs={ "class": "js-link-site-widget", "widget": "site", - "data-placeholder": "XXX", #_("Select site"), + "data-placeholder": _("Select site"), }, ), # Site selector LinkAutoCompleteWidget( diff --git a/tests/test_plugins.py b/tests/test_plugins.py index 8bd7f4ff..d7fd0ff8 100644 --- a/tests/test_plugins.py +++ b/tests/test_plugins.py @@ -178,7 +178,7 @@ def test_file(self): self.assertIn("/media/filer_public/", plugin.get_link()) def test_rendering(self): - plugin = add_plugin( + add_plugin( self.get_placeholders(self.page, self.language).get(slot="content"), "LinkPlugin", "en", @@ -191,12 +191,12 @@ def test_rendering(self): self.assertContains(response, 'Link') def test_rendering_fallback(self): - plugin = add_plugin( + add_plugin( self.get_placeholders(self.page, self.language).get(slot="content"), "LinkPlugin", "en", name="Link", - link={"internal_link": f"cms.page:0"}, + link={"internal_link": "cms.page:0"}, ) self.publish(self.page, self.language) diff --git a/tests/test_validators.py b/tests/test_validators.py index 3ee3ee7e..76c73834 100644 --- a/tests/test_validators.py +++ b/tests/test_validators.py @@ -15,7 +15,7 @@ def assertDoesNotValidate(self, validator, value): try: validator(value) self.fail(f"Validation of {value} unexpectedly did not fail") - except Exception as e: + except Exception: pass def test_intranet_host_re(self):