Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion backend/contributions/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -2066,9 +2066,15 @@ class FeaturedContentViewSet(viewsets.ReadOnlyModelViewSet):
pagination_class = None

def get_queryset(self):
queryset = FeaturedContent.objects.filter(status='active').select_related(
include_inactive = (
self.request.query_params.get('include_inactive', '').lower()
in ('1', 'true', 'yes')
)
queryset = FeaturedContent.objects.select_related(
'user', 'contribution', 'contribution__contribution_type'
).order_by('order', '-created_at')
if not include_inactive:
queryset = queryset.filter(status='active')
content_type = self.request.query_params.get('type')
if content_type:
queryset = queryset.filter(content_type=content_type)
Expand Down
14 changes: 12 additions & 2 deletions backend/gen_tv/admin.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,19 @@
from django.contrib import admin

from utils.admin_mixins import CloudinaryUploadMixin

from .models import Stream


@admin.register(Stream)
class StreamAdmin(admin.ModelAdmin):
class StreamAdmin(CloudinaryUploadMixin, admin.ModelAdmin):
cloudinary_upload_fields = {
'image_url': {
'public_id_field': 'image_public_id',
'folder': 'tally/gen-tv',
},
}

list_display = (
'title',
'category',
Expand All @@ -18,7 +27,7 @@ class StreamAdmin(admin.ModelAdmin):
search_fields = ('title', 'description')
prepopulated_fields = {'slug': ('title',)}
date_hierarchy = 'starts_at'
readonly_fields = ('created_at', 'updated_at')
readonly_fields = ('created_at', 'updated_at', 'image_public_id')
fieldsets = (
(None, {
'fields': ('title', 'slug', 'description', 'is_active'),
Expand All @@ -28,6 +37,7 @@ class StreamAdmin(admin.ModelAdmin):
}),
('Media', {
'fields': ('url', 'image_url'),
'description': 'Upload a cover image directly or paste a Cloudinary URL.',
}),
('Timestamps', {
'fields': ('created_at', 'updated_at'),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Generated by Django 6.0.5 on 2026-05-15 11:41

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('gen_tv', '0003_upsert_fud_markets_stream'),
]

operations = [
migrations.AddField(
model_name='stream',
name='image_public_id',
field=models.CharField(blank=True, help_text='Cloudinary public ID for thumbnail / cover image.', max_length=255),
),
migrations.AlterField(
model_name='stream',
name='image_url',
field=models.URLField(blank=True, help_text='Cloudinary URL for thumbnail / cover image.', max_length=500),
),
]
7 changes: 6 additions & 1 deletion backend/gen_tv/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,12 @@ class Category(models.TextChoices):
image_url = models.URLField(
max_length=500,
blank=True,
help_text="Thumbnail / cover image URL.",
help_text="Cloudinary URL for thumbnail / cover image.",
)
image_public_id = models.CharField(
max_length=255,
blank=True,
help_text="Cloudinary public ID for thumbnail / cover image.",
)
starts_at = models.DateTimeField(
help_text="Scheduled start time (used for sorting and status).",
Expand Down
14 changes: 12 additions & 2 deletions backend/partners/admin.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,19 @@
from django.contrib import admin

from utils.admin_mixins import CloudinaryUploadMixin

from .models import Partner


@admin.register(Partner)
class PartnerAdmin(admin.ModelAdmin):
class PartnerAdmin(CloudinaryUploadMixin, admin.ModelAdmin):
cloudinary_upload_fields = {
'logo_url': {
'public_id_field': 'logo_public_id',
'folder': 'tally/partners',
},
}

list_display = (
'name',
'display_order',
Expand All @@ -16,13 +25,14 @@ class PartnerAdmin(admin.ModelAdmin):
list_filter = ('is_active',)
search_fields = ('name', 'description')
prepopulated_fields = {'slug': ('name',)}
readonly_fields = ('created_at', 'updated_at')
readonly_fields = ('created_at', 'updated_at', 'logo_public_id')
fieldsets = (
(None, {
'fields': ('name', 'slug', 'description', 'is_active'),
}),
('URLs', {
'fields': ('logo_url', 'website_url', 'url'),
'description': 'Upload a logo directly or paste a Cloudinary URL.',
}),
('Display', {
'fields': ('display_order',),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Generated by Django 6.0.5 on 2026-05-15 11:41

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('partners', '0001_initial'),
]

operations = [
migrations.AddField(
model_name='partner',
name='logo_public_id',
field=models.CharField(blank=True, help_text='Cloudinary public ID for partner logo.', max_length=255),
),
migrations.AlterField(
model_name='partner',
name='logo_url',
field=models.URLField(blank=True, help_text='Cloudinary URL for partner logo.', max_length=500),
),
]
3 changes: 2 additions & 1 deletion backend/partners/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ class Partner(BaseModel):
name = models.CharField(max_length=200)
slug = models.SlugField(max_length=200, unique=True)
description = models.TextField(blank=True)
logo_url = models.URLField(max_length=500, blank=True)
logo_url = models.URLField(max_length=500, blank=True, help_text="Cloudinary URL for partner logo.")
logo_public_id = models.CharField(max_length=255, blank=True, help_text="Cloudinary public ID for partner logo.")
website_url = models.URLField(
max_length=500,
help_text="Official website (primary redirect target).",
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/routes/GenNews.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@

onMount(async () => {
try {
const heroRes = await featuredAPI.getHero();
const heroRes = await featuredAPI.getFeatured({ type: 'hero', include_inactive: true });
const fetchedAnnouncements = dedupeById(
asArray(heroRes.data).map((item) => normalizeAnnouncement(item, 'hero'))
);
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading