#35886: Move object-based media assets to the public API
-------------------------------------+-------------------------------------
Reporter: Johannes Maron | Type:
| Cleanup/optimization
Status: new | Component: Forms
Version: dev | Severity: Normal
Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
This is a successor to #29490 and a result of the discussion on #22298 and
[
https://forum.djangoproject.com/t/rejuvenating-vs-deprecating-form-
media/21285 its corresponding forum thread].
This ticket aims to move object-based media assets to the public API and
documentation.
A sample implementation has been part of the test suite for years, see
also:
https://github.com/django/django/blob/97a6a678c406b0049bd17bcd34f1d71d96141994/tests/forms_tests/tests/test_media.py#L717-L771
The goal is to support form assets with modern attributes, like:
{{{
<script type="module">
<!-- or -->
<script defer>
<!-- or -->
<script async>
}}}
And other standardized attributes, see
https://developer.mozilla.org/en-
US/docs/Web/HTML/Element/script
The same can be done for stylesheets via the link tag, which does support
many more attributes than `media`, see also:
https://developer.mozilla.org
/en-US/docs/Web/HTML/Element/link
**Considerations**
We could deprecate "string" based assets. This may simplify `django.forms`
since, the CSS grouping wouldn't be needed anymore.
--
Ticket URL: <
https://code.djangoproject.com/ticket/35886>
Django <
https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.