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 %}
<h1> Tools </h1>
{% if tools %}
<ul>
{% for tool in tools %}
<li><a href="{{ tool.get_absolute_url }}">{{ tool.name }}</a></li>
{% endfor %}
</ul>
{% else %}
<p>No tools are available.</p>
{% endif %}
<ul>
{% for tool in tools %}
<li><a href="{{ tool.get_absolute_url }}">{{ tool.name }}</a></li>
{% empty %}
<p>No tools are available.</p>
{% endfor %}
</ul>
<h1> Tasks </h1>
{% if tasks %}
<ul>
{% 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>
{% endfor %}
</ul>
{% else %}
<p>No tasks are available.</p>
{% endif %}
<ul>
{% 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>
{% empty %}
<p>No tasks are available.</p>
{% endfor %}
</ul>
{% endblock %}