Tsallaka zuwa abun ciki
Justice Tech School

Template Tags

Tags use percent braces for logic.

Example
{% if user.is_authenticated %}
  <p>Welcome</p>
{% else %}
  <p>Login</p>
{% endif %}
{% for p in posts %}
  <li>{{ p.title }}</li>
{% empty %}
  <li>None</li>
{% endfor %}

Exercise

Loop tag.

{%  p in posts %}

Quiz Test

What does empty do in a for?

These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.