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'>  <!-- {% block content %} -->
</dj-block>  <!-- {% endblock 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>  <!-- {% 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.13.1.tar.gz (75.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dj_angles-0.13.1-py3-none-any.whl (24.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: dj_angles-0.13.1.tar.gz
  • Upload date:
  • Size: 75.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for dj_angles-0.13.1.tar.gz
Algorithm Hash digest
SHA256 9e0b709d22665ef144b7d0886825a23cb0782e612fdb2948bc63f8943afab63e
MD5 688bfd6450e6afc786bd6bddfca5d409
BLAKE2b-256 292af830192fab536b9ee470d2f9160b9727b2f571edf547929c34c7a8db2650

See more details on using hashes here.

Provenance

The following attestation bundles were made for dj_angles-0.13.1.tar.gz:

Publisher: publish.yml on adamghill/dj-angles

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

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

File metadata

  • Download URL: dj_angles-0.13.1-py3-none-any.whl
  • Upload date:
  • Size: 24.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for dj_angles-0.13.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4ffcc2b2483488a40ef05d54d5c740baa593dcc7accf3c7340b86f468f4eae18
MD5 c17c5535ef865d3495577389c9d6d855
BLAKE2b-256 cd6123ee248c56a7ff0a63451952e4d37e86e715272efbe95ea7d61eedf6d1bf

See more details on using hashes here.

Provenance

The following attestation bundles were made for dj_angles-0.13.1-py3-none-any.whl:

Publisher: publish.yml on adamghill/dj-angles

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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