Add Twitch directory URL property to Game model and update dashboard to handle channel display logic

This commit is contained in:
Joakim Hellsén 2025-09-09 03:22:45 +02:00
commit c8cc6d83df
2 changed files with 44 additions and 24 deletions

View file

@ -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."""