[Django] #36537: Generate unique IDs for the OSM layer mapwidget options `json_script` tags

8 views
Skip to first unread message

Django

unread,
Aug 1, 2025, 8:22:05 AMAug 1
to django-...@googlegroups.com
#36537: Generate unique IDs for the OSM layer mapwidget options `json_script` tags
-------------------------------------+-------------------------------------
Reporter: Matthias | Owner: Matthias Kestenholz
Kestenholz |
Type: | Status: assigned
Cleanup/optimization |
Component: GIS | Version: 5.2
Severity: Normal | Keywords:
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
The `application/json` script tag uses `id="mapwidget-options"` even when
used multiple times on the same page. This is invalid HTML, let's change
this to use unique IDs.

Refs https://github.com/django/django/pull/19566 and
https://code.djangoproject.com/ticket/25706
--
Ticket URL: <https://code.djangoproject.com/ticket/36537>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Aug 1, 2025, 8:25:52 AMAug 1
to django-...@googlegroups.com
#36537: Generate unique IDs for the OSM layer mapwidget options `json_script` tags
-------------------------------------+-------------------------------------
Reporter: Matthias Kestenholz | Owner: Matthias
Type: | Kestenholz
Cleanup/optimization | Status: assigned
Component: GIS | Version: 5.2
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Matthias Kestenholz):

* has_patch: 0 => 1

Comment:

[https://github.com/django/django/pull/19692 PR]
--
Ticket URL: <https://code.djangoproject.com/ticket/36537#comment:1>

Django

unread,
Aug 1, 2025, 8:27:07 AMAug 1
to django-...@googlegroups.com
#36537: Generate unique IDs for the OSM layer mapwidget options `json_script` tags
-------------------------------------+-------------------------------------
Reporter: Matthias Kestenholz | Owner: Matthias
| Kestenholz
Type: Bug | Status: assigned
Component: GIS | Version: dev
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Natalia Bidart):

* stage: Unreviewed => Accepted
* type: Cleanup/optimization => Bug
* version: 5.2 => dev

Comment:

Thank you Matthias! This follows an extensive conversation in the
referenced PR.
--
Ticket URL: <https://code.djangoproject.com/ticket/36537#comment:2>

Django

unread,
Aug 1, 2025, 8:27:26 AMAug 1
to django-...@googlegroups.com
#36537: Generate unique IDs for the OSM layer mapwidget options `json_script` tags
-------------------------------------+-------------------------------------
Reporter: Matthias Kestenholz | Owner: Matthias
| Kestenholz
Type: Bug | Status: assigned
Component: GIS | Version: dev
Severity: Release blocker | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Natalia Bidart):

* severity: Normal => Release blocker

Comment:

This is a release blocker for 6.0.
--
Ticket URL: <https://code.djangoproject.com/ticket/36537#comment:3>

Django

unread,
Aug 4, 2025, 2:46:50 PMAug 4
to django-...@googlegroups.com
#36537: Generate unique IDs for the OSM layer mapwidget options `json_script` tags
-------------------------------------+-------------------------------------
Reporter: Matthias Kestenholz | Owner: Matthias
| Kestenholz
Type: Bug | Status: assigned
Component: GIS | Version: dev
Severity: Release blocker | Resolution:
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Natalia Bidart):

* stage: Accepted => Ready for checkin

--
Ticket URL: <https://code.djangoproject.com/ticket/36537#comment:4>

Django

unread,
Aug 5, 2025, 10:35:16 AMAug 5
to django-...@googlegroups.com
#36537: Generate unique IDs for the OSM layer mapwidget options `json_script` tags
-------------------------------------+-------------------------------------
Reporter: Matthias Kestenholz | Owner: Matthias
| Kestenholz
Type: Bug | Status: closed
Component: GIS | Version: dev
Severity: Release blocker | Resolution: fixed
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by nessita <124304+nessita@…>):

* resolution: => fixed
* status: assigned => closed

Comment:

In [changeset:"0a262c8407a2f4e4971118ca435c6931c40b70ae" 0a262c84]:
{{{#!CommitTicketReference repository=""
revision="0a262c8407a2f4e4971118ca435c6931c40b70ae"
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 `<script>` elements in the
admin with the same HTML `id`, resulting in invalid HTML and fragile
JavaScript selectors. Refs #25706.

This change uses the widget's textarea ID to generate a unique `id` for
each JSON options `<script>`, ensuring valid and robust markup.

Co-authored-by: Natalia <124304+...@users.noreply.github.com>
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/36537#comment:5>
Reply all
Reply to author
Forward
0 new messages