# Buildsheet autogenerated by ravenadm tool -- Do not edit. NAMEBASE= python-django-js-asset VERSION= 1.2.2 KEYWORDS= python VARIANTS= py38 py39 SDESC[py38]= Django forms.Media script tag (PY38) SDESC[py39]= Django forms.Media script tag (PY39) HOMEPAGE= https://github.com/matthiask/django-js-asset/ CONTACT= Python_Automaton[python@ironwolf.systems] DOWNLOAD_GROUPS= main SITES[main]= PYPIWHL/aa/2d/98089cf51c8e83bc70723021390b94a3638a4a0ce30a47e2e70476b2095d DISTFILE[1]= django_js_asset-1.2.2-py2.py3-none-any.whl:main DF_INDEX= 1 SPKGS[py38]= single SPKGS[py39]= single OPTIONS_AVAILABLE= PY38 PY39 OPTIONS_STANDARD= none VOPTS[py38]= PY38=ON PY39=OFF VOPTS[py39]= PY38=OFF PY39=ON DISTNAME= django_js_asset-1.2.2.dist-info GENERATED= yes [PY38].USES_ON= python:py38,wheel [PY39].USES_ON= python:py39,wheel [FILE:1988: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, so specify them as follows:: JS( "https://cdn.example.com/script.js", {"defer": "defer"}, static=False, ) Compatibility ============= At the time of writing this app is compatible with Django 1.7 and better (up to and including the Django master branch), but have a look at the [Travis CI build] for definitive answers. [FILE:121:distinfo] 8ec12017f26eec524cab436c64ae73033368a372970af4cf42d9354fcb166bdd 5775 django_js_asset-1.2.2-py2.py3-none-any.whl