Ravenports generated: 02 Jul 2023 00:24
[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=                2.1.0
5 KEYWORDS=               python
6 VARIANTS=               py310 v11
7 SDESC[py310]=           Django forms.Media script tag (3.10)
8 SDESC[v11]=             Django forms.Media script tag (3.11)
9 HOMEPAGE=               none
10 CONTACT=                Python_Automaton[python@ironwolf.systems]
11
12 DOWNLOAD_GROUPS=        main
13 SITES[main]=            PYPIWHL/6b/97/dc8601f87f22498a02c1183cf3d691079440b3c97704b327be778c55391e
14 DISTFILE[1]=            django_js_asset-2.1.0-py3-none-any.whl:main
15 DF_INDEX=               1
16 SPKGS[py310]=           single
17 SPKGS[v11]=             single
18
19 OPTIONS_AVAILABLE=      PY310 PY311
20 OPTIONS_STANDARD=       none
21 VOPTS[py310]=           PY310=ON PY311=OFF
22 VOPTS[v11]=             PY310=OFF PY311=ON
23
24 DISTNAME=               django_js_asset-2.1.0.dist-info
25
26 GENERATED=              yes
27
28 [PY310].RUN_DEPENDS_ON=                 python-Django:single:py310
29 [PY310].USES_ON=                        python:py310,wheel
30
31 [PY311].RUN_DEPENDS_ON=                 python-Django:single:v11
32 [PY311].USES_ON=                        python:v11,wheel
33
34 [FILE:2042:descriptions/desc.single]
35 ===============================================================================
36 django-js-asset -- script tag with additional attributes for
37 django.forms.Media
38 ===============================================================================
39
40 Usage
41 =====
42
43 Use this to insert a script tag via ``forms.Media`` containing additional
44 attributes (such as id and ``data-*`` for CSP-compatible data
45 injection.):
46
47 .. code-block:: python
48
49     from js_asset import JS
50
51     forms.Media(js=[
52         JS("asset.js", {
53             "id": "asset-script",
54             "data-answer": "42",
55         }),
56    ])
57
58 The rendered media tag (via ``{{ media.js }} or {{ media }}`` will
59 now contain a script tag as follows, without line breaks:
60
61 .. code-block:: html
62
63     <script type="text/javascript" src="/static/asset.js"
64         data-answer="42" id="asset-script"></script>
65
66 The attributes are automatically escaped. The data attributes may now be
67 accessed inside ``asset.js``:
68
69 .. code-block:: javascript
70
71     var answer = document.querySelector("#asset-script").dataset.answer;
72
73 Also, because the implementation of static differs between supported
74 Django versions (older do not take the presence of
75 ``django.contrib.staticfiles in INSTALLED_APPS`` into account), a
76 ``js_asset.static`` function is provided which does the right thing
77 automatically.
78
79 When adding external script assets, you should pass ``static=False to the
80 JS object to avoid passing the script URL through static()``. In this
81 case, you probably want to add defer or async, and maybe also
82 integrity and crossorigin attributes. Please note that boolean
83 attributes are not properly supported when using Django before 4.1 so
84 specify
85 them as follows:
86
87 .. code-block:: python
88
89     JS(
90         "https://cdn.example.com/script.js",
91         {"defer": "defer"},
92         static=False,
93     )
94
95 Compatibility
96 =============
97
98 At the time of writing this app is compatible with Django 1.8 and better
99 (up to and including the Django master branch), but have a look at the
100 [tox configuration
101 ] for
102 definitive answers.
103
104
105 [FILE:117:distinfo]
106 36a3a4dd6e9efc895fb127d13126020f6ec1ec9469ad42878d42143f22495d90         4698 django_js_asset-2.1.0-py3-none-any.whl
107