Commit d1ad391c authored by Ciaran Ainsworth's avatar Ciaran Ainsworth Committed by Georg Krause
Browse files

Add prefetched covers to history view

parent 79a8fa59
......@@ -56,7 +56,7 @@ class ListeningViewSet(
)
tracks = Track.objects.with_playable_uploads(
music_utils.get_actor_from_request(self.request)
).select_related("artist", "album__artist", "attributed_to")
).select_related("artist", "album__artist", "attributed_to", "artist__attachment_cover")
return queryset.prefetch_related(Prefetch("track", queryset=tracks))
def get_serializer_context(self):
......
......@@ -162,12 +162,14 @@ def serialize_artist_simple(artist):
"content_category": artist.content_category,
}
if "description" in artist._state.fields_cache:
data["description"] = (
common_serializers.ContentSerializer(artist.description).data
if artist.description
else None
)
if "attachment_cover" in artist._state.fields_cache:
data["cover"] = (
cover_field.to_representation(artist.attachment_cover)
if artist.attachment_cover
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment