# Buildsheet autogenerated by ravenadm tool -- Do not edit. NAMEBASE= python-django-js-asset VERSION= 2.1.0 KEYWORDS= python VARIANTS= py310 v11 SDESC[py310]= Django forms.Media script tag (3.10) SDESC[v11]= Django forms.Media script tag (3.11) HOMEPAGE= none CONTACT= Python_Automaton[python@ironwolf.systems] DOWNLOAD_GROUPS= main SITES[main]= PYPIWHL/6b/97/dc8601f87f22498a02c1183cf3d691079440b3c97704b327be778c55391e DISTFILE[1]= django_js_asset-2.1.0-py3-none-any.whl:main DF_INDEX= 1 SPKGS[py310]= single SPKGS[v11]= single OPTIONS_AVAILABLE= PY310 PY311 OPTIONS_STANDARD= none VOPTS[py310]= PY310=ON PY311=OFF VOPTS[v11]= PY310=OFF PY311=ON DISTNAME= django_js_asset-2.1.0.dist-info GENERATED= yes [PY310].RUN_DEPENDS_ON= python-Django:single:py310 [PY310].USES_ON= python:py310,wheel [PY311].RUN_DEPENDS_ON= python-Django:single:v11 [PY311].USES_ON= python:v11,wheel [FILE:2042:descriptions/desc.single] =============================================================================== django-js-asset -- script tag with additional attributes for django.forms.Media =============================================================================== Usage ===== Use this to insert a script tag via ``forms.Media`` containing additional attributes (such as id and ``data-*`` for CSP-compatible data injection.): .. code-block:: python from js_asset import JS forms.Media(js=[ JS("asset.js", { "id": "asset-script", "data-answer": "42", }), ]) The rendered media tag (via ``{{ media.js }} or {{ media }}`` will now contain a script tag as follows, without line breaks: .. code-block:: html The attributes are automatically escaped. The data attributes may now be accessed inside ``asset.js``: .. code-block:: javascript var answer = document.querySelector("#asset-script").dataset.answer; Also, because the implementation of static differs between supported Django versions (older do not take the presence of ``django.contrib.staticfiles in INSTALLED_APPS`` into account), a ``js_asset.static`` function is provided which does the right thing automatically. When adding external script assets, you should pass ``static=False to the JS object to avoid passing the script URL through static()``. In this case, you probably want to add defer or async, and maybe also integrity and crossorigin attributes. Please note that boolean attributes are not properly supported when using Django before 4.1 so specify them as follows: .. code-block:: python JS( "https://cdn.example.com/script.js", {"defer": "defer"}, static=False, ) Compatibility ============= At the time of writing this app is compatible with Django 1.8 and better (up to and including the Django master branch), but have a look at the [tox configuration ] for definitive answers. [FILE:117:distinfo] 36a3a4dd6e9efc895fb127d13126020f6ec1ec9469ad42878d42143f22495d90 4698 django_js_asset-2.1.0-py3-none-any.whl