https://github.com/adamghill/dj-angles
Transpile HTML to the Django Template Language </>
https://github.com/adamghill/dj-angles
css django django-templates html web-components
Last synced: 4 months ago
JSON representation
Transpile HTML to the Django Template Language </>
- Host: GitHub
- URL: https://github.com/adamghill/dj-angles
- Owner: adamghill
- License: mit
- Created: 2024-09-01T20:25:48.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2025-03-28T12:26:03.000Z (about 1 year ago)
- Last Synced: 2025-04-02T12:52:10.531Z (about 1 year ago)
- Topics: css, django, django-templates, html, web-components
- Language: Python
- Homepage: https://dj-angles.adamghill.com
- Size: 578 KB
- Stars: 35
- Watchers: 2
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
dj-angles </>



[](#contributors-)
- 📖 Complete documentation: https://dj-angles.adamghill.com/
- 📦 Package: https://pypi.org/project/dj-angles/
## ⭐ Features
- Use HTML-like elements in Django templates, e.g. `` 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](https://dj-angles.adamghill.com/en/latest/components/#css-scoping) to encapsulate component styles
- Lightweight way to submit forms via AJAX and swap in the resulting HTML
- Error boundaries to catch and display template errors
### Component library integrations
- Support for Django 6.0 [template partials](https://docs.djangoproject.com/en/stable/ref/templates/language/#template-partials)
- [django-components](https://django-components.github.io/django-components/)
- [django-viewcomponent](https://github.com/rails-inspire-django/django-viewcomponent)
- [django-bird](https://django-bird.readthedocs.io)
- [django-template-partials](https://github.com/carltongibson/django-template-partials)
### Template tags
- [`call`](https://dj-angles.adamghill.com/en/latest/template-tags/call/): call functions in a template
- [`model`](https://dj-angles.adamghill.com/en/latest/template-tags/model/): call a model in a template
- [`template`](https://dj-angles.adamghill.com/en/latest/template-tags/template/): inline template
- [`view`](https://dj-angles.adamghill.com/en/latest/template-tags/view/): render a view in a template
### Filters
- [`dateformat`](https://dj-angles.adamghill.com/en/latest/filters/dateformat/): use Python [`strftime`](https://strftime.org) format for formatting dates as a string
## 💥 Examples
```html
```
```html
This is verbatim: {% include %}
this is a comment
This is escaped
This is not escaped
```
```html
```
```html
```
```html
{{ request.user.username or request.user.email }}
{{ request.user.username if request.user.is_authenticated else 'Unknown' }}
```
```html
```
```html
Submit
```
```html
If
Elif
Else
```
## 📖 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](https://mitchel.me/slippers/): Build reusable components in Django without writing a single line of Python.
- [django-components](https://django-components.github.io/django-components/): Create simple reusable template components in Django.
- [django-template-partials](https://github.com/carltongibson/django-template-partials): Reusable named inline partials for the Django Template Language.
- [django-bird](https://django-bird.readthedocs.io): High-flying components for perfectionists with deadlines.
- [django-cotton](https://django-cotton.com): Enabling Modern UI Composition in Django.
- [django-viewcomponent](https://github.com/rails-inspire-django/django-viewcomponent): Build reusable components in Django, inspired by Rails ViewComponent.
- [django-unicorn](https://www.django-unicorn.com): The magical reactive component framework for Django ✨.
## ✨ Inspiration
- [Web Components](https://web.dev/learn/html/template)
- [django-cotton](https://django-cotton.com) by [wrabit](https://github.com/wrabit)
## 🙌 Contributors