Tags¶
The dj-angles approach is shown first and then the equivalent Django Template Language is second.
#¶
<dj-#>...</dj-#>
{# ... #}
autoescape-off¶
<dj-autoescape-off>
...
</dj-autoescape-off>
{% autoescape off %}
{% endautoescape %}
autoescape-on¶
<dj-autoescape-on>
...
</dj-autoescape-on>
{% autoescape on %}
{% endautoescape %}
block¶
<dj-block name='content'>
...
</dj-block>
Note
The end tag can optionally have a name attribute. If it is missing, the endblock will use the name attribute from the start tag.
<dj-block name='content'>
...
</dj-block name='content'>
Note
The tag can be self-closing if there is not default block content.
<dj-block name='content' />
{% block content %}
...
{% endblock content %}
call¶
<dj-call code='slugify("Hello Goodbye")' as='variable_name' />
{% call slugify("Hello Goodbye") as variable_name %}
csrf, csrf-token, csrf-input¶
<dj-csrf />
{% csrf_token %}
comment¶
<dj-comment>
...
</dj-comment>
{% comment %}
...
{% endcomment %}
css¶
<dj-css href='css/styles.css' />
<link href="{% static 'css/styles.css' %}" rel="stylesheet" />
debug¶
<dj-debug />
{% debug %}
extends¶
<dj-extends parent='base' />
<dj-extends parent='base.html' />
{% extends 'base.html' %}
filter¶
<dj-filter ... />
{% filter ... %}
form¶
ajax¶
Whether or not the form should be submitted via AJAX. Uses the ajax-form custom element.
<dj-form action='/submit' method='POST' ajax>
...
</dj-form>
<ajax-form>
<form action='/submit' method='POST'>
...
</form>
</ajax-form>
swap¶
Defines how the form should be replaced after submission. Valid values are outerHTML and innerHTML.
<dj-form action='/submit' method='POST' ajax swap='outerHTML'>
...
</dj-form>
<ajax-form>
<form action='/submit' method='POST'>
...
</form>
</ajax-form>
csrf¶
Whether or not the form should include a CSRF token.
<dj-form action='/submit' method='POST' csrf>
...
</dj-form>
<form action='/submit' method='POST'>{% csrf_token %}
...
</form>
lorem¶
<dj-lorem />
{% lorem %}
image¶
<dj-image src='img/django.jpg' />
<img src="{% static 'img/django.jpg' %}" />
model¶
<dj-model code='Book.objects.filter(id=1)' as='book' />
{% model Book.objects.filter(id=1) as book %}
now¶
<dj-now />
{% now %}
spaceless¶
<dj-spaceless>
...
</dj-spaceless>
{% spaceless %}
...
{% endspaceless %}
templatetag¶
<dj-templatetag ... />
{% templatetag ... %}
verbatim¶
<dj-verbatim>
...
</dj-verbatim>
{% verbatim %}
...
{% endverbatim %}