Account for no sessions
This commit is contained in:
parent
4f67bd85c7
commit
a32d6c38ab
|
@ -23,6 +23,7 @@
|
|||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if dataset.count != 0 %}
|
||||
<table class="responsive-table">
|
||||
<thead>
|
||||
<tr>
|
||||
|
@ -73,4 +74,7 @@
|
|||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
{% else %}
|
||||
<div class="mx-auto text-center text-slate-300 text-xl">No sessions found.</div>
|
||||
{% endif %}
|
||||
{% endblock content %}
|
||||
|
|
|
@ -7,6 +7,7 @@ from django.http import HttpRequest, HttpResponse, HttpResponseRedirect
|
|||
from django.shortcuts import redirect, render
|
||||
from django.urls import reverse
|
||||
from django.utils import timezone
|
||||
from django.core.exceptions import ObjectDoesNotExist
|
||||
|
||||
from common.time import format_duration
|
||||
from common.utils import safe_division
|
||||
|
@ -298,7 +299,10 @@ def list_sessions(
|
|||
|
||||
context["total_duration"] = dataset.total_duration_formatted()
|
||||
context["dataset"] = dataset
|
||||
context["last"] = Session.objects.latest()
|
||||
try:
|
||||
context["last"] = Session.objects.latest()
|
||||
except ObjectDoesNotExist:
|
||||
context["last"] = None
|
||||
|
||||
return render(request, "list_sessions.html", context)
|
||||
|
||||
|
|
Loading…
Reference in New Issue