From 0a262c8407a2f4e4971118ca435c6931c40b70ae Mon Sep 17 00:00:00 2001 From: Matthias Kestenholz Date: Sun, 15 Jun 2025 16:38:10 +0200 Subject: [PATCH] Fixed #36537 -- Ensured unique HTML IDs for geometry widget option scripts in the admin. This work amends the code from f2f6046c0f92ff1faed057da0711ac478eef439c where multiple geometry widgets rendered ` `; @@ -154,7 +154,7 @@ QUnit.test('initMapWidgetInSection initializes widgets and skips __prefix__', fu wrapper2.innerHTML = `
- `; diff --git a/tests/gis_tests/test_geoforms.py b/tests/gis_tests/test_geoforms.py index 2a1f585906..753505fc68 100644 --- a/tests/gis_tests/test_geoforms.py +++ b/tests/gis_tests/test_geoforms.py @@ -214,7 +214,7 @@ class GeometryFieldTest(SimpleTestCase): "id": "id_p", "geom_name": "Point", } - expected = json_script(attrs, "mapwidget-options") + expected = json_script(attrs, "id_p_mapwidget_options") self.assertInHTML(expected, rendered) @@ -305,7 +305,7 @@ class SpecializedFieldTest(SimpleTestCase): "id": map_field.id_for_label, "geom_name": geom_name, } - expected = json_script(attrs, "mapwidget-options") + expected = json_script(attrs, f"{map_field.id_for_label}_mapwidget_options") self.assertInHTML(expected, rendered) self.assertIn("gis/js/OLMapWidget.js", str(form_instance.media)) @@ -475,7 +475,7 @@ class OSMWidgetTest(SimpleTestCase): "id": "id_p", "geom_name": "Point", } - expected = json_script(attrs, "mapwidget-options") + expected = json_script(attrs, "id_p_mapwidget_options") self.assertInHTML(expected, rendered)