From 29a0eae85d1a1cb9421a19147bc9a8a88fa409e7 Mon Sep 17 00:00:00 2001 From: Dylan Verheul Date: Tue, 10 Oct 2023 08:59:57 +0200 Subject: [PATCH] Fix Python versions in test matrix (#651) --- pyproject.toml | 2 +- src/bootstrap4/components.py | 4 +--- src/bootstrap4/forms.py | 6 ++---- src/bootstrap4/templatetags/bootstrap4.py | 6 +----- 4 files changed, 5 insertions(+), 13 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 7c0be553..80c27def 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -88,8 +88,8 @@ python = ["3.11"] [tool.hatch.envs.all.overrides] matrix.django.dependencies = [ {value = "django~=3.2.0", if = ["3.2"]}, - {value = "django~=4.0.0", if = ["4.0"]}, {value = "django~=4.1.0", if = ["4.1"]}, + {value = "django~=4.2.0", if = ["4.2"]}, {value = "django @ git+https://github.com/django/django.git", if = ["main"]}, ] diff --git a/src/bootstrap4/components.py b/src/bootstrap4/components.py index eca03448..a72d5a03 100644 --- a/src/bootstrap4/components.py +++ b/src/bootstrap4/components.py @@ -15,9 +15,7 @@ def render_alert(content, alert_type=None, dismissible=True): if dismissible: css_classes.append("alert-dismissible") close = _("close") - button = ( - '' - ).format(close=close) + button = f'' button_placeholder = "__BUTTON__" return mark_safe( render_tag( diff --git a/src/bootstrap4/forms.py b/src/bootstrap4/forms.py index 6a1d80bb..3bf07e0e 100644 --- a/src/bootstrap4/forms.py +++ b/src/bootstrap4/forms.py @@ -81,10 +81,8 @@ def render_button( if button_type: if button_type not in ("submit", "reset", "button", "link"): raise BootstrapError( - ( - 'Parameter "button_type" should be "submit", "reset", "button", "link" or empty ' - '("{button_type}" given).' - ).format(button_type=button_type) + 'Parameter "button_type" should be "submit", "reset", "button", "link" or empty ' + f'("{button_type}" given).' ) if button_type != "link": attrs["type"] = button_type diff --git a/src/bootstrap4/templatetags/bootstrap4.py b/src/bootstrap4/templatetags/bootstrap4.py index 256b3fa9..656851ab 100644 --- a/src/bootstrap4/templatetags/bootstrap4.py +++ b/src/bootstrap4/templatetags/bootstrap4.py @@ -898,11 +898,7 @@ def get_pagination_context( """Generate Bootstrap pagination context from a page object.""" pages_to_show = int(pages_to_show) if pages_to_show < 1: - raise ValueError( - "Pagination pages_to_show should be a positive integer, you specified {pages_to_show}.".format( - pages_to_show=pages_to_show - ) - ) + raise ValueError(f"Pagination pages_to_show should be a positive integer, you specified {pages_to_show}.") num_pages = page.paginator.num_pages current_page = page.number half_page_num = int(floor(pages_to_show / 2))