From efd3acbc703140823da29c9f4f1db84480a05897 Mon Sep 17 00:00:00 2001 From: Colin Powell Date: Wed, 22 Mar 2023 23:30:26 -0400 Subject: [PATCH] Fix saving producers --- vrobbler/apps/podcasts/models.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/vrobbler/apps/podcasts/models.py b/vrobbler/apps/podcasts/models.py index f5e80f6..5a3ca14 100644 --- a/vrobbler/apps/podcasts/models.py +++ b/vrobbler/apps/podcasts/models.py @@ -44,9 +44,11 @@ class Podcast(TimeStampedModel): podcast_dict = scrape_data_from_google_podcasts(self.name) if podcast_dict: if not self.producer: - self.producer = podcast_dict.get("producer") + self.producer = Producer.objects.get_or_create( + name=podcast_dict["producer"] + ) self.description = podcast_dict.get("description") - self.save(update_fields=["producer", "description"]) + self.save(update_fields=["description", "producer"]) cover_url = podcast_dict.get("image_url") if (not self.cover_image or force) and cover_url: