Skip to main content

Add more bracket angles to Django templates </>

Project description

dj-angles </>

PyPI PyPI - Downloads GitHub Sponsors All Contributors

⭐ Features

  • Use HTML-like elements in Django templates, e.g. <dj-partial /> instead of {% include 'partial.html' %}
  • Wraps include templates in a custom element for easier debugging and targeted CSS styling
  • Can be sprinkled in as needed to enhance existing Django functionality
  • Since it looks like HTML, syntax highlighting mostly "just works"
  • Integrates with Django component libraries like django-bird
  • Lets you excitedly tell your friends how neat the Shadow DOM is
  • Pretend like you are writing React components, but without dealing with a JavaScript build process

💥 Example

base.html

<dj-block name='content'>
</dj-block name='content'>

index.html

<dj-extends parent='base.html' />  <!-- {% extends 'base.html' %} -->

<dj-block name='content'>  <!-- {% block content %} -->
  <dj-include template='partial.html' />  <!-- {% include '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-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 name='content'>  <!-- {% endblock content %} -->

partial.html

<div>
  This is a partial: {{ now|date:"c" }}
</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

💻 ⚠️ 📖

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dj_angles-0.10.1.tar.gz (67.0 kB view details)

Uploaded Source

Built Distribution

dj_angles-0.10.1-py3-none-any.whl (16.5 kB view details)

Uploaded Python 3

File details

Details for the file dj_angles-0.10.1.tar.gz.

File metadata

  • Download URL: dj_angles-0.10.1.tar.gz
  • Upload date:
  • Size: 67.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for dj_angles-0.10.1.tar.gz
Algorithm Hash digest
SHA256 50a1b3e4ed8fc11717bb0ed7d2c01d34e915e4792cf3b33445f6ae78cd5f58b4
MD5 b6fcadc9452b38f47ae5cf00917fb3c9
BLAKE2b-256 dd15506202fa40389840f670959adb28d9835fe10bcdbd76a8e1e557c77a3003

See more details on using hashes here.

File details

Details for the file dj_angles-0.10.1-py3-none-any.whl.

File metadata

  • Download URL: dj_angles-0.10.1-py3-none-any.whl
  • Upload date:
  • Size: 16.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for dj_angles-0.10.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b367d5789fbd4307c2e05ad134922498911122564e2a6e416ed3d17757ad3a71
MD5 ca23ae4cde070a8c65c68f001a95c679
BLAKE2b-256 2acdb1ef8ce629334af1e181fe802f3ae2e06620feadaf4d4d8a6d253b79b152

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page