What is Django Template Language (DTL)?
Why Interviewers Ask This
Interviewers use this question to quickly assess whether a candidate has the foundational knowledge required for Django development. It reveals whether you understand the building blocks that more complex concepts rely on.
Answer
Django Template Language (DTL) is Django's built-in template engine for rendering HTML with dynamic data. Variables: {{ variable }} — renders the value; {{ user.username }} — attribute access; {{ dictionary.key }} — dict access; {{ list.0 }} — index access. Tags: {% if condition %}...{% elif %}...{% else %}...{% endif %}; {% for item in items %}{{ item.name }}{% empty %}No items{% endfor %}; {% url "view-name" arg1 arg2 %} — URL generation; {% include "partial.html" %} — include template; {% extends "base.html" %} — template inheritance; {% block content %}...{% endblock %} — define block for child templates; {% load staticfiles %}{% static "css/style.css" %} — static files; {% csrf_token %} — CSRF protection in forms. Filters: {{ name|lower }}; {{ text|truncatewords:30 }}; {{ date|date:"M d, Y" }}; {{ price|floatformat:2 }}; {{ html_content|safe }} — mark as safe (no escaping); {{ items|length }}; {{ value|default:"N/A" }}. Template inheritance: base.html defines blocks; child templates extend and fill them: {% extends "base.html" %}{% block title %}Article{% endblock %}{% block content %}<h1>{{ article.title }}</h1>{% endblock %}. DTL auto-escapes HTML by default — prevents XSS. Alternative: Jinja2 is also supported.
Pro Tip
Back up your answer with a specific project or situation. Saying 'In my last Django project, I used this when...' immediately makes your answer more credible and memorable.