Enhance RSS feed documentation with example XML and filtered feeds

This commit is contained in:
Joakim Hellsén 2026-02-09 17:27:13 +01:00
commit 2f9c5a9328
Signed by: Joakim Hellsén
SSH key fingerprint: SHA256:/9h/CsExpFp+PRhsfA0xznFx2CGfTT5R/kpuFfUgEQk
6 changed files with 130 additions and 72 deletions

View file

@ -6,10 +6,12 @@ from typing import TYPE_CHECKING
from django.db import models
from django.urls import reverse
from django.utils import timezone
from django.utils.html import format_html
if TYPE_CHECKING:
import datetime
logger: logging.Logger = logging.getLogger("ttvdrops")
@ -55,6 +57,18 @@ class Organization(models.Model):
"""Return a string representation of the organization."""
return self.name or self.twitch_id
def feed_description(self: Organization) -> str:
"""Return a description of the organization for RSS feeds."""
name: str = self.name or "Unknown Organization"
url: str = reverse("twitch:organization_detail", args=[self.twitch_id])
return format_html(
"<p>New Twitch organization added to TTVDrops:</p>\n"
'<p><a href="{}" target="_blank" rel="noopener noreferrer">{}</a></p>',
url,
name,
)
# MARK: Game
class Game(models.Model):