Enhance RSS feed documentation with example XML and filtered feeds
This commit is contained in:
parent
f4dd987f73
commit
2f9c5a9328
6 changed files with 130 additions and 72 deletions
|
|
@ -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):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue