In Django templates, what is the difference between {{ }} and {% %}?
Correct answer
A. {{ }} outputs variables; {% %} runs tags like for/if
15 views
A. {{ }} outputs variables; {% %} runs tags like for/if
15 views
{{ product.name }} prints a value, auto-escaped against XSS. {% for %}, {% if %} and {% url %} are template tags that control logic. Comments use {# #}.
Asked in: Python Developer Interviews, NTS
Not sure why the answer is A? Ask here and get an explanation.