1 # Buildsheet autogenerated by ravenadm tool -- Do not edit.
3 NAMEBASE= python-django-js-asset
7 SDESC[py37]= Django forms.Media script tag (PY37)
8 SDESC[py38]= Django forms.Media script tag (PY38)
9 HOMEPAGE= https://github.com/matthiask/django-js-asset/
10 CONTACT= Python_Automaton[python@ironwolf.systems]
13 SITES[main]= PYPI/d/django-js-asset
14 DISTFILE[1]= django-js-asset-1.2.2.tar.gz:main
19 OPTIONS_AVAILABLE= PY38 PY37
20 OPTIONS_STANDARD= none
21 VOPTS[py37]= PY38=OFF PY37=ON
22 VOPTS[py38]= PY38=ON PY37=OFF
24 DISTNAME= django-js-asset-1.2.2
28 [PY37].USES_ON= python:py37
30 [PY38].USES_ON= python:py38
32 [FILE:1988:descriptions/desc.single]
33 ===============================================================================
34 django-js-asset -- script tag with additional attributes for
36 ===============================================================================
41 Use this to insert a script tag via ``forms.Media`` containing additional
42 attributes (such as id and ``data-*`` for CSP-compatible data
45 .. code-block:: python
47 from js_asset import JS
56 The rendered media tag (via ``{{ media.js }} or {{ media }}`` will
57 now contain a script tag as follows, without line breaks:
61 <script type="text/javascript" src="/static/asset.js"
62 data-answer="42" id="asset-script"></script>
64 The attributes are automatically escaped. The data attributes may now be
65 accessed inside ``asset.js``:
67 .. code-block:: javascript
69 var answer = document.querySelector("#asset-script").dataset.answer;
71 Also, because the implementation of static differs between supported
72 Django versions (older do not take the presence of
73 ``django.contrib.staticfiles in INSTALLED_APPS`` into account), a
74 ``js_asset.static`` function is provided which does the right thing
77 When adding external script assets, you should pass ``static=False to
78 the JS object to avoid passing the script URL through static()``.
79 In this case, you probably want to add defer or async, and maybe
80 also integrity and crossorigin attributes. Please note that
81 boolean attributes are not properly supported, so specify them as
85 "https://cdn.example.com/script.js",
93 At the time of writing this app is compatible with Django 1.7 and better
94 (up to and including the Django master branch), but have a look at the
100 c163ae80d2e0b22d8fb598047cd0dcef31f81830e127cfecae278ad574167260 4436 django-js-asset-1.2.2.tar.gz