From 486f650ea6781200ac34de3292a3c4b354e9a8bd Mon Sep 17 00:00:00 2001 From: "Edgar P. Burkhart" Date: Sun, 15 Jun 2025 16:11:24 +0200 Subject: [PATCH] Add GameManager for filtering active games and update group_games template --- base/static/css/main.css | 2 +- game/models.py | 7 +++++++ game/templates/game/include/group_games.html | 5 +++++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/base/static/css/main.css b/base/static/css/main.css index d81f86f..23dffab 100644 --- a/base/static/css/main.css +++ b/base/static/css/main.css @@ -25,7 +25,7 @@ i.owner, .gold { display: none; } -a.group { +a.group, a.running { text-decoration: none; } diff --git a/game/models.py b/game/models.py index 0affa8c..ef85fd8 100644 --- a/game/models.py +++ b/game/models.py @@ -68,6 +68,11 @@ class MusicVideo(models.Model): ] +class GameManager(models.Manager): + def playing(self): + return self.filter(over=False) + + class MusikGame(models.Model): group = models.ForeignKey(Group, on_delete=models.CASCADE) date = models.DateTimeField(auto_now_add=True) @@ -77,6 +82,8 @@ class MusikGame(models.Model): playlist_loading = models.BooleanField(default=False) over = models.BooleanField(default=False) + objects = GameManager() + def get_absolute_url(self): return reverse("game_detail", kwargs={"pk": self.pk}) diff --git a/game/templates/game/include/group_games.html b/game/templates/game/include/group_games.html index 09ad49a..15016fb 100644 --- a/game/templates/game/include/group_games.html +++ b/game/templates/game/include/group_games.html @@ -1,5 +1,10 @@ {% load form youtube %} {% if group.musikgame_set.exists %} + {% for game in group.musikgame_set.playing %} + +
{{ game.date }}
+
+ {% endfor %}

Parties