Skip to main content

dj-angles </>

PyPI PyPI - Downloads GitHub Sponsors All Contributors

⭐ Features

  • Use HTML-like elements in Django templates, e.g. <dj-some-partial /> instead of {% include 'some-partial.html' %}
  • Can be sprinkled in as needed to enhance existing Django functionality
  • Since it looks like HTML, syntax highlighting mostly "just works"
  • Wraps components in a custom HTML element for easier debugging and targeted CSS styling
  • Support for the Shadow DOM to encapsulate component styles
  • Error boundaries to catch and display template errors
  • Lightweight way to submit forms via AJAX and swap in the resulting HTML

Third-party package integrations

Template tags

  • call: call functions in a template
  • model: call a model in a template
  • template: lightweight inline template
  • view: render a view in a template

Filters

💥 Examples

<!-- base.html -->
<dj-block name="content">  <!-- {% block content %} -->
</dj-block>  <!-- {% endblock content %} -->
<!-- template-tags.html -->
<dj-extends parent="base.html" />  <!-- {% extends "base.html" %} -->

<dj-block name="content">  <!-- {% block content %} -->
  <!-- components -->
  <dj-some-partial />  <!-- {% include "test-partial.html" %} -->
  <dj-include template="test-partial.html" />  <!-- {% include "test-partial.html" %} -->

  <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 %} -->
</dj-block>  <!-- {% endblock content %} -->
<!-- static-helpers.html -->
<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" /> -->
<!-- call-code-from-template.html -->
<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 %} -->
<dj-view name="some-view" />  <!-- {% view "some-view" %} -->
<!-- django-compressor.html -->
<dj-compress css> <!-- {% compress css %} -->
  <style>.critical { color: red; }</style>
</dj-compress> <!-- {% endcompress %} -->
<!-- third-party-component-libraries.html -->

<!-- django-components -->
<dj-component name="button">Click me</dj-component>  <!-- {% component "button" %}Click me{% endcomponent %} -->

<!-- django-viewcomponent -->
<dj-viewcomponent name="button">Click me</dj-viewcomponent>  <!-- {% viewcomponent "button" %}Click me{% endviewcomponent %} -->

<!-- django-bird -->
<dj-bird template="button" class="btn">Click me</dj-bird>  <!-- {% bird "button" class="btn" %}Click me{% endbird %} -->

<!-- django-template-partials -->
<dj-partial name="sidebar">  <!-- {% partialdef sidebar %} -->
  <p>Sidebar content</p>
</dj-partial>  <!-- {% endpartialdef %} -->

<dj-partial name="sidebar" />  <!-- {% partial sidebar %} -->
<!-- inline-expressions.html -->
{{ request.user.username or request.user.email }}  <!-- {% if request.user.username %}{{ request.user.username }}{% else %}{{ request.user.email }}{% endif %} -->
{{ request.user.username if request.user.is_authenticated else "Unknown" }}  <!-- {% if request.user.is_authenticated %}{{ request.user.username }}{% else %}Unknown{% endif %} -->
<!-- error-boundaries.html -->
<dj-block name="content" error-boundary>
  <dj-include template="missing-template.html" />
</dj-block>

<dj-error-boundary>
  <dj-include template="missing-template.html" />
</dj-error-boundary>
<!-- ajax-form-submission.html -->
<dj-form action="/submit" method="POST" swap="outerHTML" ajax csrf> <!-- <ajax-form><form action="/submit" method="POST">{% csrf_token %} -->
  <button type="submit">Submit</button>
</dj-form><!-- </form></ajax-form> -->
<!-- conditional-attributes.html -->
<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 %} -->
<!-- value-attribute.html -->
<div dj-value="request.user">  <!-- <div>{{ request.user }}</div> -->
</div>

📖 Documentation

To learn how to install and use dj-angles see the complete documentation at https://dj-angles.adamghill.com/.

✨ Inspiration

🙌 Contributors

Emmanuelle Delescolle
Emmanuelle Delescolle

💻 ⚠️ 📖
Jarkko Saltiola
Jarkko Saltiola

📖

Metadata

Release files for dj-angles 0.27.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for dj-angles 0.27.0
File Size Uploaded
dj_angles-0.27.0.tar.gz 37.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for dj-angles 0.27.0
File Interpreter ABI Platform
dj_angles-0.27.0-py3-none-any.whl Python 3 none any Details

Total release size: 89.2 kB

Release files / dj_angles-0.27.0.tar.gz

Download URL dj_angles-0.27.0.tar.gz
Size 37.6 kB
Tags Source
SHA-256 checksum
How to use checksums
56c394232f96568314ed0f37241edbc03448550123ca16f2e5c7b0bbbcceb735
BLAKE2b-256 checksum
How to use checksums
644abda29b7e7573fdbbea638ce597a96f9ce7ee64f7e2f87f7c2c2f6668cc11
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 5, 2026.

Transparency log

Release files / dj_angles-0.27.0-py3-none-any.whl

Download URL dj_angles-0.27.0-py3-none-any.whl
Size 51.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
59762f1dab6b16a97ca6dc515669db7d0a7fe4414b06afea337f6603f90aecd7
BLAKE2b-256 checksum
How to use checksums
4b24a6b454661a4440bd516596c89f8701fcc00732363c31cb5566658e442906
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 5, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.27.0 This release

2 release files

0.25.0

2 release files

0.24.0

2 release files

0.23.0

2 release files

0.21.0

2 release files

0.20.0

2 release files

0.19.0

2 release files

0.18.0

2 release files

0.17.0

2 release files

0.16.0

2 release files

0.15.0

2 release files

0.14.0

2 release files

0.12.0

2 release files

0.10.1

2 release files

0.10.0

2 release files

0.9.0

2 release files

0.8.1

2 release files

0.8.0

2 release files

0.7.0

2 release files

0.6.1

2 release files

0.6.0

2 release files

0.5.0

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page