Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions openwisp_monitoring/device/tests/test_admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"<h2>{heading}</h2>"
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",
Expand Down Expand Up @@ -643,7 +642,14 @@ def _assert_alertsettings_inline_in_response(response):
'<img src="/static/admin/img/icon-yes.svg" alt="True">',
html=True,
)
self.assertContains(response, "<h2>Advanced options</h2>", html=True)
# TODO: Remove when dropping support for Django 4.2
self.assertContains(
response,
(
'<h{heading_level} class="fieldset-heading">Advanced options</h{heading_level}>'
).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",
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -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
Loading