**Django 템플릿 언어(DTL)**는 HTML을 동적으로 생성하는 데 사용됩니다. template은 데이터 삽입, 반복, 조건문을 위한 특수 문법을 갖춘 HTML 파일입니다. DTL은 의도적으로 template 내 로직을 제한하여, 표현을 비즈니스 로직(view에 속함)과 분리합니다.
세 가지 주요 문법
{{ 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" }}
