#33302 closed New feature (fixed)
Make the element_id argument of json_script optional
Reported by: | Baptiste Mispelon | Owned by: | Baptiste Mispelon |
---|---|---|---|
Component: | Template system | Version: | 3.2 |
Severity: | Normal | Keywords: | |
Cc: | Baptiste Mispelon | Triage Stage: | Ready for checkin |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
I recently had a use-case where I wanted to use json_script
but I didn't need any id
for it (I was including the <script>
inside a <template>
so I didn't need an id
to refer to it).
I can't see any reason (security or otherwise) for the id
to be required and making it optional doesn't seem to break any tests.
Change History (5)
comment:1 by , 3 years ago
Cc: | added |
---|---|
Has patch: | set |
comment:3 by , 3 years ago
Owner: | changed from | to
---|---|
Triage Stage: | Accepted → Ready for checkin |
comment:5 by , 3 years ago
Just wanna say thanks for the feature. I just had the same thought and wrote #33469 before finding it has already been done!
Note:
See TracTickets
for help on using tickets.
PR is here: https://github.com/django/django/pull/15103