Add podcast field for google url

This commit is contained in:
2023-03-23 00:06:14 -04:00
parent 04a48af4c9
commit 70118e2e62
3 changed files with 55 additions and 19 deletions

View File

@ -32,7 +32,8 @@ class Podcast(TimeStampedModel):
)
description = models.TextField(**BNULL)
active = models.BooleanField(default=True)
url = models.URLField(**BNULL)
feed_url = models.URLField(**BNULL)
google_podcasts_url = models.URLField(**BNULL)
cover_image = models.ImageField(upload_to="podcasts/covers/", **BNULL)
def __str__(self):
@ -54,8 +55,14 @@ class Podcast(TimeStampedModel):
name=podcast_dict["producer"]
)
self.description = podcast_dict.get("description")
self.url = podcast_dict.get("url")
self.save(update_fields=["description", "producer", "url"])
self.google_podcasts_url = podcast_dict.get("google_url")
self.save(
update_fields=[
"description",
"producer",
"google_podcasts_url",
]
)
cover_url = podcast_dict.get("image_url")
if (not self.cover_image or force) and cover_url: