From 895c74e08a59cba501180a3df83c4b9c762b4cee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20J=C3=BClg?= <tobias@juelg.net> Date: Fri, 20 May 2022 22:29:32 +0200 Subject: [PATCH] Show banner if no sessions exist --- management/templates/management/index.html | 5 +++++ management/views.py | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/management/templates/management/index.html b/management/templates/management/index.html index f92fe2d..8152fc8 100644 --- a/management/templates/management/index.html +++ b/management/templates/management/index.html @@ -12,6 +12,11 @@ </div> <div class="card-body"> <div class="list-group"> + {% if len_sessions == 0 %} + <div class="list-group-item mt-3"> + <span>You have no sessions currently.</span> + </div> + {% endif %} {% for session in sessions %} <div class="list-group-item list-group-item-action"> <a class="main-link" href="{% url 'management:session' session.id %}"></a> diff --git a/management/views.py b/management/views.py index 795a8e0..655e2f7 100644 --- a/management/views.py +++ b/management/views.py @@ -84,7 +84,8 @@ def index(request): context={'form': form, 'variables': form.variables}) context = { - 'sessions': manager.sessions.order_by('-pk') + 'sessions': manager.sessions.order_by('-pk'), + 'len_sessions': manager.sessions.count(), } return render(request, template_name='management/index.html', context=context) -- GitLab