Przeglądaj źródła

Fix saving producers

Colin Powell 2 lat temu
rodzic
commit
efd3acbc70
1 zmienionych plików z 4 dodań i 2 usunięć
  1. 4 2
      vrobbler/apps/podcasts/models.py

+ 4 - 2
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: