mirror of
https://code.eliotberriot.com/funkwhale/funkwhale.git
synced 2025-10-05 06:19:24 +02:00
Small performance enhancements
This commit is contained in:
parent
5623b6d88b
commit
1ca7f62aab
2 changed files with 52 additions and 81 deletions
|
@ -436,7 +436,7 @@ class TrackQuerySet(common_models.LocalFromFidQuerySet, models.QuerySet):
|
|||
return self.exclude(pk__in=matches)
|
||||
|
||||
def with_playable_uploads(self, actor):
|
||||
uploads = Upload.objects.playable_by(actor).select_related("track")
|
||||
uploads = Upload.objects.playable_by(actor)
|
||||
return self.prefetch_related(
|
||||
models.Prefetch("uploads", queryset=uploads, to_attr="playable_uploads")
|
||||
)
|
||||
|
@ -594,7 +594,8 @@ class Track(APIModelMixin):
|
|||
|
||||
@property
|
||||
def listen_url(self):
|
||||
return reverse("api:v1:listen-detail", kwargs={"uuid": self.uuid})
|
||||
# Not using reverse because this is slow
|
||||
return "/api/v1/listen/{}/".format(self.uuid)
|
||||
|
||||
@property
|
||||
def local_license(self):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue