Use {% empty %} instead of if/else in index

This commit is contained in:
Adam Goldsmith 2021-01-21 17:10:15 -05:00
parent 48e5ec1ca3
commit 58a5645cdf

View File

@ -4,24 +4,20 @@
{% block content %} {% block content %}
<h1> Tools </h1> <h1> Tools </h1>
{% if tools %} <ul>
<ul> {% for tool in tools %}
{% for tool in tools %} <li><a href="{{ tool.get_absolute_url }}">{{ tool.name }}</a></li>
<li><a href="{{ tool.get_absolute_url }}">{{ tool.name }}</a></li> {% empty %}
{% endfor %} <p>No tools are available.</p>
</ul> {% endfor %}
{% else %} </ul>
<p>No tools are available.</p>
{% endif %}
<h1> Tasks </h1> <h1> Tasks </h1>
{% if tasks %} <ul>
<ul> {% for task in tasks %}
{% for task in tasks %} <li><a href="{{ task.get_absolute_url }}">{{ task.name }}</a> - last at {{ task.last_event.date|date }}, next at {{ task.next_recurrence|date }} </li>
<li><a href="{{ task.get_absolute_url }}">{{ task.name }}</a> - last at {{ task.last_event.date|date }}, next at {{ task.next_recurrence|date }} </li> {% empty %}
{% endfor %} <p>No tasks are available.</p>
</ul> {% endfor %}
{% else %} </ul>
<p>No tasks are available.</p>
{% endif %}
{% endblock %} {% endblock %}