diff --git a/vrobbler/apps/music/models.py b/vrobbler/apps/music/models.py index d907fd7..6b96457 100644 --- a/vrobbler/apps/music/models.py +++ b/vrobbler/apps/music/models.py @@ -168,6 +168,15 @@ class Album(TimeStampedModel): track__in=self.track_set.all() ).order_by("-timestamp") + @property + def primary_image_url(self) -> str: + url = "" + if self.thumbnail: + url = self.thumbnail.url + if not url and self.album_set.first().cover_image: + url = self.album_set.first().cover_image.url + return url + @property def tracks(self): return ( diff --git a/vrobbler/templates/music/artist_detail.html b/vrobbler/templates/music/artist_detail.html index 1d75a70..266f972 100644 --- a/vrobbler/templates/music/artist_detail.html +++ b/vrobbler/templates/music/artist_detail.html @@ -9,7 +9,7 @@ {% if object.thumbnail %}

- +

{% else %} {% if object.album_set.first.cover_image %} diff --git a/vrobbler/templates/music/artist_list.html b/vrobbler/templates/music/artist_list.html index 6075dc9..8440be2 100644 --- a/vrobbler/templates/music/artist_list.html +++ b/vrobbler/templates/music/artist_list.html @@ -34,7 +34,7 @@ {% for artist in object_list %} {% if artist.thumbnail %}
-
+
{% endif %} {% endfor %}