mirror of
https://code.eliotberriot.com/funkwhale/funkwhale.git
synced 2025-10-04 15:39:16 +02:00
Updated playlist management API
This commit is contained in:
parent
a1865cf9d8
commit
f6458fd75a
10 changed files with 157 additions and 247 deletions
|
@ -203,6 +203,15 @@ class PlaylistTrackQuerySet(models.QuerySet):
|
|||
else:
|
||||
return self.exclude(track__pk__in=tracks).distinct()
|
||||
|
||||
def by_index(self, index):
|
||||
plts = self.order_by("index").values_list("id", flat=True)
|
||||
try:
|
||||
plt_id = plts[index]
|
||||
except IndexError:
|
||||
raise PlaylistTrack.DoesNotExist
|
||||
|
||||
return PlaylistTrack.objects.get(pk=plt_id)
|
||||
|
||||
|
||||
class PlaylistTrack(models.Model):
|
||||
track = models.ForeignKey(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue