Commits

Anonymous committed 131b662

Use for/empty to avoid an extra if tag

Comments (0)

Files changed (1)

05-template/django/01-initial/welcome.html

                     <a href="/signin">Sign in</a>
                 {% endif %}
             </div>
-            {% 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 %}
         </div>