dj-angles Integration¶
If you prefer HTML-like component tags, django-bird works well with dj-angles.
Install¶
Install django-bird with the optional angles extra:
python -m pip install 'django-bird[angles]'
Or install manually:
python -m pip install django-bird dj-angles
Configure Django template loaders¶
Add the dj-angles template loader before Django’s filesystem/app loaders:
# settings.py
TEMPLATES = [
{
"BACKEND": "django.template.backends.django.DjangoTemplates",
"DIRS": [BASE_DIR / "templates"],
"OPTIONS": {
"loaders": [
(
"django.template.loaders.cached.Loader",
[
"dj_angles.template_loader.Loader",
"django.template.loaders.filesystem.Loader",
"django.template.loaders.app_directories.Loader",
],
)
],
"builtins": [
"django_bird.templatetags.django_bird",
],
},
},
]
Common tag styles¶
A few practical conventions:
dj-bird+ explicit template namedj-prefix for component-like tags when using the default mapper
Explicit dj-bird tag¶
<dj-bird template="button" class="btn-primary">
Click me
</dj-bird>
References¶
dj-angles django-bird integration docs: https://dj-angles.adamghill.com/en/latest/integrations/django-bird/
django-bird configuration docs: configuration