Add more bracket angles to Django templates </>
Project description
dj-angles </>
- 📖 Complete documentation: https://dj-angles.adamghill.com/
- 📦 Package: https://pypi.org/project/dj-angles/
⭐ Features
- Use HTML-like elements in Django templates, e.g.
<dj-partial />instead of{% include 'partial.html' %} - Can be sprinkled in as needed to enhance existing Django functionality
- Since it looks like HTML, syntax highlighting mostly "just works"
- Wraps included templates in a custom element for easier debugging and targeted CSS styling
- Support for making components with the Shadow DOM
- Integrates with Django component libraries like django-bird
💥 Example
base.html
<dj-block name='content'> <!-- {% block content %} -->
</dj-block> <!-- {% endblock content %} -->
index.html
<dj-extends parent='base.html' /> <!-- {% extends 'base.html' %} -->
<dj-block name='content'> <!-- {% block content %} -->
<!-- components -->
<dj-partial /> <!-- {% include 'partial.html' %} -->
<dj-include template='partial.html' /> <!-- {% include 'partial.html' %} -->
<!-- evaluate code from the template -->
<dj-call code='slugify("Hello Goodbye")' as='variable_name' /> <!-- {% call slugify("Hello Goodbye") as variable_name %} -->
<dj-model code='Book.objects.filter(id=1)' as='book' /> <!-- {% model Book.objects.filter(id=1) as book %} -->
<!-- conditional attributes -->
<div dj-if="True"> <!-- {% if True %}<div> -->
If
</div>
<div dj-elif="False"> <!-- {% elif False %}<div> -->
Elif
</div>
<div dj-else> <!-- {% else %}<div> -->
Else
</div> <!-- </div>{% endif %} -->
<dj-verbatim> <!-- {% verbatim %} -->
This is verbatim: {% include %}
</dj-verbatim> <!-- {% endverbatim %} -->
<dj-comment> <!-- {% comment %} -->
this is a comment
</dj-comment> <!-- {% endcomment %} -->
<dj-autoescape-on> <!-- {% autoescape-on %} -->
This is escaped
</dj-autoescape-on> <!-- {% endautoescape %} -->
<dj-autoescape-off> <!-- {% autoescape off %} -->
This is not escaped
</dj-autoescape-off> <!-- {% endautoescape %} -->
<dj-csrf /> <!-- {% csrf_token %} -->
<dj-debug /> <!-- {% debug %} -->
<!-- static helpers -->
<dj-image src='img/django.jpg' /> <!-- <img src="{% static 'img/django.jpg' %}" /> -->
<dj-css href='css/styles.css' /> <!-- <link href="{% static 'css/styles.css' %}" rel="stylesheet" /> -->
</dj-block> <!-- {% endblock content %} -->
📖 Documentation
To learn how to install and use dj-angles see the complete documentation at https://dj-angles.adamghill.com/.
🧩 Django Component Libraries
There are a growing number of component libraries for Django. A non-complete list:
- Slippers: Build reusable components in Django without writing a single line of Python.
- django-components: Create simple reusable template components in Django.
- django-template-partials: Reusable named inline partials for the Django Template Language.
- django-bird: High-flying components for perfectionists with deadlines.
- django-cotton: Enabling Modern UI Composition in Django.
- django-viewcomponent: Build reusable components in Django, inspired by Rails ViewComponent.
- django-unicorn: The magical reactive component framework for Django ✨.
✨ Inspiration
🙌 Contributors
Emmanuelle Delescolle 💻 ⚠️ 📖 |
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file dj_angles-0.16.0.tar.gz.
File metadata
- Download URL: dj_angles-0.16.0.tar.gz
- Upload date:
- Size: 90.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
20b6fd3a2654f1793525d3a4903938e75cc0e84b006ef1fc7a9bb734d6ba8066
|
|
| MD5 |
e18ed8baf923e455ca5825c174d05143
|
|
| BLAKE2b-256 |
3ac399bdb4cb84e0cfedf2fba4ce552ef13c5ee5921106c9ae4eae90cebf9720
|
Provenance
The following attestation bundles were made for dj_angles-0.16.0.tar.gz:
Publisher:
publish.yml on adamghill/dj-angles
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
dj_angles-0.16.0.tar.gz -
Subject digest:
20b6fd3a2654f1793525d3a4903938e75cc0e84b006ef1fc7a9bb734d6ba8066 - Sigstore transparency entry: 182862431
- Sigstore integration time:
-
Permalink:
adamghill/dj-angles@5484b481d089a0101bae71586865f7b3792f8959 -
Branch / Tag:
refs/tags/0.16.0 - Owner: https://github.com/adamghill
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@5484b481d089a0101bae71586865f7b3792f8959 -
Trigger Event:
release
-
Statement type:
File details
Details for the file dj_angles-0.16.0-py3-none-any.whl.
File metadata
- Download URL: dj_angles-0.16.0-py3-none-any.whl
- Upload date:
- Size: 34.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
58b7f77e775d3b002cc4a92f8af349ea14a1e68e11f5555ce7b2e92e14b9b5a8
|
|
| MD5 |
e2e351deb98a5b71d8b2420d8e694889
|
|
| BLAKE2b-256 |
db022465132ace80a0d95f44dc91bbd57bfe24d830f77db84aa7fcdf61f9e883
|
Provenance
The following attestation bundles were made for dj_angles-0.16.0-py3-none-any.whl:
Publisher:
publish.yml on adamghill/dj-angles
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
dj_angles-0.16.0-py3-none-any.whl -
Subject digest:
58b7f77e775d3b002cc4a92f8af349ea14a1e68e11f5555ce7b2e92e14b9b5a8 - Sigstore transparency entry: 182862434
- Sigstore integration time:
-
Permalink:
adamghill/dj-angles@5484b481d089a0101bae71586865f7b3792f8959 -
Branch / Tag:
refs/tags/0.16.0 - Owner: https://github.com/adamghill
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@5484b481d089a0101bae71586865f7b3792f8959 -
Trigger Event:
release
-
Statement type: