Commits

Anonymous committed baaabac

Use for/empty to avoid an extra if tag

  • Participants
  • Parent commits cfc0be0

Comments (0)

Files changed (1)

05-template/django/03-extends/welcome.html

 {% endblock %}
 
 {% block content %}
-    {% if items %}
-        {% for i in items %}
-        <p>
-            {{ i.name }}: {{ i.price|safe }}
-        </p>
-        {% endfor %}
-    {% else %}
+    {% for i in items %}
+    <p>
+        {{ i.name }}: {{ i.price|safe }}
+    </p>
+    {% empty %}
         <p>No items found.</p>
     {% endif %}
 {% endblock %}