From 3662b4f5ee9ac58a9fe6206c52b64c17e412f9f0 Mon Sep 17 00:00:00 2001 From: Laurent Date: Mon, 2 Sep 2024 14:56:40 +0200 Subject: [PATCH] hide clubs without event --- tournaments/views.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tournaments/views.py b/tournaments/views.py index 2673c37..c79a66b 100644 --- a/tournaments/views.py +++ b/tournaments/views.py @@ -111,7 +111,12 @@ def tournaments(request): ) def clubs(request): - clubs = Club.objects.all().order_by('name') + all_clubs = Club.objects.all().order_by('name') + clubs = [] + for club in all_clubs: + if club.events_count() > 0: + clubs.append(club) + return render(request, 'tournaments/clubs.html', { 'clubs': clubs, })