Commit a495ace3 authored by Auri's avatar Auri
Browse files

Credits: prefetch credits in various sets

parent a63c5ddf
Pipeline #2828 failed with stages
in 33 seconds
......@@ -97,6 +97,7 @@ class AlbumViewSet(viewsets.ReadOnlyModelViewSet):
models.Track.objects.select_related("artist")
.with_playable_uploads(utils.get_actor_from_request(self.request))
.order_for_album()
.prefetch_related("track_credits")
)
qs = queryset.prefetch_related(Prefetch("tracks", queryset=tracks))
return qs.distinct()
......@@ -190,7 +191,7 @@ class TrackViewSet(TagViewSetMixin, viewsets.ReadOnlyModelViewSet):
queryset = queryset.with_playable_uploads(
utils.get_actor_from_request(self.request)
)
).prefetch_related("track_credits")
return queryset
@detail_route(methods=["get"])
......@@ -367,6 +368,7 @@ class UploadViewSet(
models.Upload.objects.all()
.order_by("-creation_date")
.select_related("library", "track__artist", "track__album__artist")
.prefetch_related("track__track_credits")
)
serializer_class = serializers.UploadForOwnerSerializer
permission_classes = [
......
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