HTML To Django
Converts HTML files with special attributes to Django templates.
Installation
pip install html-to-django
Usage
html_to_django [-h] [-r] path
path can either be a path to a file or a folder. When a file is passed only the file itself will be converted. When a folder is passed, all files ending in .html will be replaced. This searches through the folder recursivley.
Use -r to replace the original files, instead of creating new ones.
By default, new ones are created in place next to the existing files, with the extension .n.html.
You can also use the html_to_django_r command if you are unable to pass the -r parameter
(e.g. with the Bootstrap Studio "Export Script" setting).
Attributes
To add Django template tags to your HTML files, you need to add special attributes to your HTML tags like this:
<div dj-for="user in users">
<p>{{ user.name }}</p>
</div>
This will be converted to:
{% for user in users %}
<p>{{ user.name }}</p>
{% endfor %}
A complete list of supported attributes can be found here.
Contributing
To learn how to contribute to this project, please see CONTRIBUTING.md.
Metadata
Release files for html-to-django 0.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| html_to_django-0.0.2.tar.gz | 20.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| html_to_django-0.0.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 38.3 kB
Release files / html_to_django-0.0.2.tar.gz
| Download URL | html_to_django-0.0.2.tar.gz |
|---|---|
| Size | 20.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
de0275c6aab8afb050cf75750c1e63957f0d767f380cc08883d5819c76b4c6a7
|
|
BLAKE2b-256 checksum How to use checksums |
7d6ea8bc689681959bc25c78b07225930723b04c2a0303bf74b84953d8b6a0fc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/5.0.0 CPython/3.12.3
|
Release files / html_to_django-0.0.2-py3-none-any.whl
| Download URL | html_to_django-0.0.2-py3-none-any.whl |
|---|---|
| Size | 18.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4a6ca1092935574bed5c566272e1dc6e914291747e00a1c3d33e1f548aab17e9
|
|
BLAKE2b-256 checksum How to use checksums |
4db52fbedeca7e147694ba3aadeab558516c29993345f36feeb8092be156134a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/5.0.0 CPython/3.12.3
|