mirror of
https://code.eliotberriot.com/funkwhale/funkwhale.git
synced 2025-10-05 03:29:23 +02:00
Views and logic for custom radios
This commit is contained in:
parent
df63252105
commit
e7f0c1b88b
13 changed files with 774 additions and 18 deletions
|
@ -262,6 +262,16 @@ class Lyrics(models.Model):
|
|||
extensions=['markdown.extensions.nl2br'])
|
||||
|
||||
|
||||
class TrackQuerySet(models.QuerySet):
|
||||
def for_nested_serialization(self):
|
||||
return (self.select_related()
|
||||
.select_related('album__artist')
|
||||
.prefetch_related(
|
||||
'tags',
|
||||
'files',
|
||||
'artist__albums__tracks__tags'))
|
||||
|
||||
|
||||
class Track(APIModelMixin):
|
||||
title = models.CharField(max_length=255)
|
||||
artist = models.ForeignKey(
|
||||
|
@ -302,6 +312,7 @@ class Track(APIModelMixin):
|
|||
import_hooks = [
|
||||
import_tags
|
||||
]
|
||||
objects = TrackQuerySet.as_manager()
|
||||
tags = TaggableManager()
|
||||
|
||||
class Meta:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue