| single |
=============================================================================
django-js-asset -- Script, Stylesheet and JSON support for
django.forms.Media
=============================================================================
django-js-asset brings Django's object-based media assets to every
supported
Django version and adds what Django doesn't have yet:
* [Script and Stylesheet
]
are Django's own classes where Django has them (Script arrived in 5.2,
Stylesheet in 6.1) and backports otherwise.
* InlineStyle and JSON render ``
Import Script and Stylesheet from ``django.forms`` once your project
only supports Django versions which have them. Use ``**{...}`` for
attributes
which aren't valid Python identifiers, such as ``data-*`` attributes, which
are a CSP-compatible way to pass data to a script
(``document.querySelector("#data-script").dataset.answer``). Attributes are
escaped.
All assets can go into ``js=[...]``, which is a simple list, while css
needs a dictionary keyed by medium. A stylesheet in js is only
de-duplicated against that list though, ``forms.Media keeps css`` in a
separate slot.
Inline CSS is rendered verbatim -- a ``
|