The Django Template Language (DTL) is used to generate HTML dynamically — templates are HTML files with special syntax for inserting data, looping, and conditionals. It deliberately limits logic in templates, keeping presentation separate from business logic (which belongs in views).
The three main syntaxes
{{ article.title }}
Author: {{ article.author.name }}
{% if user.is_authenticated %}
Welcome, {{ user.username }}
{% else %}
Log in
{% endif %}
{% for article in articles %}
{{ article.title }}
{% empty %}
No articles yet.
{% endfor %}
{{ name|upper }}
{{ article.body|truncatewords:30 }}
{{ price|floatformat:2 }}
{{ date|date:"Y-m-d" }}
