angrybeanie_wagtail/podcasts/models.py

46 lines
1.1 KiB
Python
Raw Permalink Normal View History

2025-07-25 21:32:16 +10:00
from django.db import models
from wagtail.models import Page
from wagtail.fields import RichTextField
from wagtail.admin.panels import FieldPanel
from wagtailmedia.edit_handlers import MediaChooserPanel
from wagtail.api import APIField
class PodcastEpisodeIndexPage(Page):
intro = RichTextField(blank=True)
description = RichTextField(blank=True)
audio_file = models.ForeignKey(
"wagtailmedia.Media",
null=True,
blank=True,
on_delete=models.SET_NULL,
related_name="+",
)
content_panels = Page.content_panels + [
FieldPanel("intro"),
FieldPanel("description"),
MediaChooserPanel("audio_file")
]
api_fields = [
APIField("intro"),
APIField('description'),
]
class PodcastSeries(Page):
description = RichTextField(blank=True)
logo = models.ForeignKey(
"wagtailimages.Image",
null=True,
blank=True,
on_delete=models.SET_NULL,
related_name="+",
help_text="Podcast Series Logo",
)
content_panels = Page.content_panels + [
FieldPanel("description"),
FieldPanel("logo")
]