From 162d752a22fccd7691d33c37c882c373290fb0cb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Joakim=20Hells=C3=A9n?=
Date: Tue, 9 Sep 2025 04:43:41 +0200
Subject: [PATCH] Add allowed channels section to campaign detail view
---
templates/twitch/campaign_detail.html | 20 ++++++++++++++++++++
twitch/views.py | 3 ++-
2 files changed, 22 insertions(+), 1 deletion(-)
diff --git a/templates/twitch/campaign_detail.html b/templates/twitch/campaign_detail.html
index 206b65b..efb5eb1 100644
--- a/templates/twitch/campaign_detail.html
+++ b/templates/twitch/campaign_detail.html
@@ -77,6 +77,26 @@
target="_blank">Connect Account
{% endif %}
+
+ {% if allowed_channels %}
+ Allowed Channels
+
+ {% else %}
+ Allowed Channels
+ All channels allowed or no channel restrictions specified.
+ {% endif %}
Campaign Info
{% if drops %}
diff --git a/twitch/views.py b/twitch/views.py
index f527937..bec7dfc 100644
--- a/twitch/views.py
+++ b/twitch/views.py
@@ -232,7 +232,7 @@ class DropCampaignDetailView(DetailView):
if queryset is None:
queryset = self.get_queryset()
- queryset = queryset.select_related("game__owner")
+ queryset = queryset.select_related("game__owner").prefetch_related("allow_channels")
return super().get_object(queryset=queryset)
@@ -337,6 +337,7 @@ class DropCampaignDetailView(DetailView):
context["drops"] = enhanced_drops
context["campaign_data"] = format_and_color_json(campaign_data[0])
context["owner"] = campaign.game.owner
+ context["allowed_channels"] = campaign.allow_channels.all().order_by("display_name")
return context