@@ -99,11 +99,10 @@ def _get_inline_admin_heading(self, heading):
9999 This method helps us generate the appropriate HTML heading format
100100 based on the Django version being used.
101101 """
102- if django .VERSION < (5 , 1 ) and heading != "Alert Settings" :
102+ if django .VERSION < (5 , 1 ) or heading in [ "Alert Settings" ] :
103103 return f"<h2>{ heading } </h2>"
104104 heading_map = {
105105 "Checks" : f"{ Check ._meta .app_label } -check-content_type-object_id-heading" ,
106- "Alert Settings" : f"{ Metric ._meta .app_label } -metric-content_type-object_id-heading" ,
107106 "WiFi Sessions" : "wifisession_set-heading" ,
108107 "Configuration" : "config-heading" ,
109108 "Map" : "devicelocation-heading" ,
@@ -643,7 +642,14 @@ def _assert_alertsettings_inline_in_response(response):
643642 '<img src="/static/admin/img/icon-yes.svg" alt="True">' ,
644643 html = True ,
645644 )
646- self .assertContains (response , "<h2>Advanced options</h2>" , html = True )
645+ # TODO: Remove when dropping support for Django 4.2
646+ self .assertContains (
647+ response ,
648+ (
649+ '<h{heading_level} class="fieldset-heading">Advanced options</h{heading_level}>'
650+ ).format (heading_level = 2 if django .VERSION < (5 , 1 ) else 4 ),
651+ html = True ,
652+ )
647653 self .assertContains (
648654 response ,
649655 "metric-content_type-object_id-0-alertsettings-0-is_active" ,
0 commit comments