From c8cc6d83df6511225e35f79c5376e9acaf632253 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joakim=20Hells=C3=A9n?= Date: Tue, 9 Sep 2025 03:22:45 +0200 Subject: [PATCH] Add Twitch directory URL property to Game model and update dashboard to handle channel display logic --- templates/twitch/dashboard.html | 63 ++++++++++++++++++++------------- twitch/models.py | 7 ++++ 2 files changed, 45 insertions(+), 25 deletions(-) diff --git a/templates/twitch/dashboard.html b/templates/twitch/dashboard.html index f7ca59c..5ac4500 100644 --- a/templates/twitch/dashboard.html +++ b/templates/twitch/dashboard.html @@ -85,34 +85,47 @@ Hover over the end time to see the exact date and time. text-align: left"> Duration: {{ campaign.start_at|timesince:campaign.end_at }} - {% if campaign.allow_channels.all %} -
- Channels: - +
{% endfor %} diff --git a/twitch/models.py b/twitch/models.py index 153e578..4ba952b 100644 --- a/twitch/models.py +++ b/twitch/models.py @@ -172,6 +172,13 @@ class Game(models.Model): return self.slug return self.id + @property + def twitch_directory_url(self) -> str: + """Return the Twitch directory URL for this game with drops filter if slug is available.""" + if self.slug: + return f"https://www.twitch.tv/directory/category/{self.slug}?filter=drops" + return "" + class Channel(models.Model): """Represents a Twitch channel that can participate in drop campaigns."""