Opened 15 years ago
Closed 14 years ago
#11865 closed New feature (duplicate)
Form media lacks support for raw javascript
Reported by: | Tareque Hossain | Owned by: | nobody |
---|---|---|---|
Component: | Forms | Version: | dev |
Severity: | Normal | Keywords: | form media raw javascript |
Cc: | tareque@… | Triage Stage: | Accepted |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
Form media allows form exclusive css and js to be linked in a systematic fashion. But it lacks support for inclusion of raw javascript that are generated on a per form basis (e.g. initialization of TinyMCE). As a result widget creators have to append javascript to their rendered widget. This translates into bad html practice of including javascript at random points of the HTML file.
This situation can be resolved by adding a third media type: raw_js which can be included at a desired point in the template as {{ form.media.raw_js }}
Attachments (2)
Change History (6)
by , 15 years ago
Attachment: | form-media-raw-javascript.patch added |
---|
by , 15 years ago
Attachment: | form-media-regression-test.patch added |
---|
Modified regression tests to accommodate changes in form media
comment:1 by , 15 years ago
Triage Stage: | Unreviewed → Accepted |
---|
I'm bikeshedding, but I'm not sure I'm a fan of raw_js as a name. There's nothing particularly 'raw' about it - it's just an embedded script rather thank a linked script.
comment:2 by , 15 years ago
I would say its a perfectly valid argument! Here are some other names I thought about (given the existing form media titles are 'css' and 'js'):
'inline_js'
'embedded_js'
or just:
'javascript'
comment:3 by , 14 years ago
Severity: | → Normal |
---|---|
Type: | → New feature |
comment:4 by , 14 years ago
Resolution: | → duplicate |
---|---|
Status: | new → closed |
Closing as dupe of #13978, which, although newer, also takes care of inline css. I believe it's better to tackle both css and js at once to maintain some consistency.
Suggested changes to django/forms/widget.py