diff --git a/openwisp_monitoring/device/tests/test_admin.py b/openwisp_monitoring/device/tests/test_admin.py index 722d7341d..3f9d6162e 100644 --- a/openwisp_monitoring/device/tests/test_admin.py +++ b/openwisp_monitoring/device/tests/test_admin.py @@ -99,11 +99,10 @@ def _get_inline_admin_heading(self, heading): This method helps us generate the appropriate HTML heading format based on the Django version being used. """ - if django.VERSION < (5, 1) and heading != "Alert Settings": + if django.VERSION < (5, 1) or heading in ["Alert Settings"]: return f"

{heading}

" heading_map = { "Checks": f"{Check._meta.app_label}-check-content_type-object_id-heading", - "Alert Settings": f"{Metric._meta.app_label}-metric-content_type-object_id-heading", "WiFi Sessions": "wifisession_set-heading", "Configuration": "config-heading", "Map": "devicelocation-heading", @@ -643,7 +642,14 @@ def _assert_alertsettings_inline_in_response(response): 'True', html=True, ) - self.assertContains(response, "

Advanced options

", html=True) + # TODO: Remove when dropping support for Django 4.2 + self.assertContains( + response, + ( + 'Advanced options' + ).format(heading_level=2 if django.VERSION < (5, 1) else 4), + html=True, + ) self.assertContains( response, "metric-content_type-object_id-0-alertsettings-0-is_active", diff --git a/requirements.txt b/requirements.txt index 6f4b6b083..39864410e 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ openwisp-controller @ https://github.com/openwisp/openwisp-controller/tarball/1.2 influxdb~=5.3.2 -django-nested-admin~=4.1.1 +django-nested-admin~=4.1.3 python-dateutil>=2.7.0,<3.0.0