Ravenports generated: 21 Nov 2021 07:10
[ravenports.git] / bucket_D5 / python-django-js-asset
1 # Buildsheet autogenerated by ravenadm tool -- Do not edit.
2
3 NAMEBASE=               python-django-js-asset
4 VERSION=                1.2.2
5 KEYWORDS=               python
6 VARIANTS=               py39 py310
7 SDESC[py310]=           Django forms.Media script tag (3.10)
8 SDESC[py39]=            Django forms.Media script tag (3.9)
9 HOMEPAGE=               https://github.com/matthiask/django-js-asset/
10 CONTACT=                Python_Automaton[python@ironwolf.systems]
11
12 DOWNLOAD_GROUPS=        main
13 SITES[main]=            PYPIWHL/aa/2d/98089cf51c8e83bc70723021390b94a3638a4a0ce30a47e2e70476b2095d
14 DISTFILE[1]=            django_js_asset-1.2.2-py2.py3-none-any.whl:main
15 DF_INDEX=               1
16 SPKGS[py310]=           single
17 SPKGS[py39]=            single
18
19 OPTIONS_AVAILABLE=      PY39 PY310
20 OPTIONS_STANDARD=       none
21 VOPTS[py310]=           PY39=OFF PY310=ON
22 VOPTS[py39]=            PY39=ON PY310=OFF
23
24 DISTNAME=               django_js_asset-1.2.2.dist-info
25
26 GENERATED=              yes
27
28 [PY39].USES_ON=                         python:py39,wheel
29
30 [PY310].USES_ON=                        python:py310,wheel
31
32 [FILE:1988:descriptions/desc.single]
33 ===============================================================================
34 django-js-asset -- script tag with additional attributes for
35 django.forms.Media
36 ===============================================================================
37
38 Usage
39 =====
40
41 Use this to insert a script tag via ``forms.Media`` containing additional
42 attributes (such as id and ``data-*`` for CSP-compatible data
43 injection.):
44
45 .. code-block:: python
46
47     from js_asset import JS
48
49     forms.Media(js=[
50         JS("asset.js", {
51             "id": "asset-script",
52             "data-answer": "42",
53         }),
54    ])
55
56 The rendered media tag (via ``{{ media.js }} or {{ media }}`` will
57 now contain a script tag as follows, without line breaks:
58
59 .. code-block:: html
60
61     <script type="text/javascript" src="/static/asset.js"
62         data-answer="42" id="asset-script"></script>
63
64 The attributes are automatically escaped. The data attributes may now be
65 accessed inside ``asset.js``:
66
67 .. code-block:: javascript
68
69     var answer = document.querySelector("#asset-script").dataset.answer;
70
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
75 automatically.
76
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
82 follows::
83
84     JS(
85         "https://cdn.example.com/script.js",
86         {"defer": "defer"},
87         static=False,
88     )
89
90 Compatibility
91 =============
92
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
95 [Travis CI build] for
96 definitive answers.
97
98
99 [FILE:121:distinfo]
100 8ec12017f26eec524cab436c64ae73033368a372970af4cf42d9354fcb166bdd         5775 django_js_asset-1.2.2-py2.py3-none-any.whl
101