Account for no sessions
Django CI/CD / build-and-push (push) Successful in 1m21s
Details
Django CI/CD / build-and-push (push) Successful in 1m21s
Details
This commit is contained in:
parent
912e010729
commit
b7e14ecc83
|
@ -23,6 +23,7 @@
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
{% if dataset.count != 0 %}
|
||||||
<table class="responsive-table">
|
<table class="responsive-table">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
|
@ -73,4 +74,7 @@
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
{% else %}
|
||||||
|
<div class="mx-auto text-center text-slate-300 text-xl">No sessions found.</div>
|
||||||
|
{% endif %}
|
||||||
{% endblock content %}
|
{% endblock content %}
|
||||||
|
|
|
@ -7,6 +7,7 @@ from django.http import HttpRequest, HttpResponse, HttpResponseRedirect
|
||||||
from django.shortcuts import redirect, render
|
from django.shortcuts import redirect, render
|
||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
from django.utils import timezone
|
from django.utils import timezone
|
||||||
|
from django.core.exceptions import ObjectDoesNotExist
|
||||||
|
|
||||||
from common.time import format_duration
|
from common.time import format_duration
|
||||||
from common.utils import safe_division
|
from common.utils import safe_division
|
||||||
|
@ -298,7 +299,10 @@ def list_sessions(
|
||||||
|
|
||||||
context["total_duration"] = dataset.total_duration_formatted()
|
context["total_duration"] = dataset.total_duration_formatted()
|
||||||
context["dataset"] = dataset
|
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)
|
return render(request, "list_sessions.html", context)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue