Opened 15 months ago
Closed 15 months ago
#34864 closed New feature (duplicate)
Add ability to customise script tags for form media
Reported by: | Tom Carrick | Owned by: | nobody |
---|---|---|---|
Component: | Forms | Version: | dev |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
It would be useful to be able to add defer
, integrity
, type="module"
, etc. onto the script tags generated by form media.
I couldn't find a way to do this currently. Perhaps something like this:
class MyForm(forms.Form): class Media: js = [ {"src": "js/foo.js", "defer": True, "type": "module"}, "js/bar.js", ]
Not sure if we should allow arbitrary stuff to be added or just choose the options that are reasonable
Note:
See TracTickets
for help on using tickets.
I think it's possible since 4c76ffc2d6c77c850b4bef8d9acc197d11c47937 by using a class instead of paths, check out an example for
integrity
. Duplicate of #29490.