python-django-js-asset
Port variant py38
Summary Django forms.Media script tag (PY38)
Package version 1.2.2
Homepage https://github.com/matthiask/django-js-asset/
Keywords python
Maintainer Python Automaton
License Not yet specified
Other variants py39
Ravenports Buildsheet | History
Ravensource Port Directory | History
Last modified 13 DEC 2020, 19:47:07 UTC
Port created 02 FEB 2018, 15:29:04 UTC
Subpackage Descriptions
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.
Configuration Switches (platform-specific settings discarded)
PY38 ON Build using Python 3.8 PY39 OFF Build using Python 3.9
Package Dependencies by Type
Build (only) python-pip:single:py38
autoselect-python:single:standard
Build and Runtime python38:single:standard
Download groups
main mirror://PYPIWHL/aa/2d/98089cf51c8e83bc70723021390b94a3638a4a0ce30a47e2e70476b2095d
Distribution File Information
8ec12017f26eec524cab436c64ae73033368a372970af4cf42d9354fcb166bdd 5775 django_js_asset-1.2.2-py2.py3-none-any.whl
Ports that require python-django-js-asset:py38
python-django-mptt:py38 Django Modified Preorder Tree Traversal (PY38)