mirror of
https://code.eliotberriot.com/funkwhale/funkwhale.git
synced 2025-10-05 06:19:24 +02:00
Fixed #33: sort by track position in album in API vy default, also reuse that information on frontend side
This commit is contained in:
parent
f1c05d4f42
commit
0786c58d3d
5 changed files with 29 additions and 6 deletions
|
@ -27,6 +27,7 @@ class APIModelMixin(models.Model):
|
|||
api_includes = []
|
||||
creation_date = models.DateTimeField(default=timezone.now)
|
||||
import_hooks = []
|
||||
|
||||
class Meta:
|
||||
abstract = True
|
||||
ordering = ['-creation_date']
|
||||
|
@ -291,6 +292,9 @@ class Track(APIModelMixin):
|
|||
]
|
||||
tags = TaggableManager()
|
||||
|
||||
class Meta:
|
||||
ordering = ['album', 'position']
|
||||
|
||||
def __str__(self):
|
||||
return self.title
|
||||
|
||||
|
@ -386,6 +390,8 @@ class ImportJob(models.Model):
|
|||
)
|
||||
status = models.CharField(choices=STATUS_CHOICES, default='pending', max_length=30)
|
||||
|
||||
class Meta:
|
||||
ordering = ('id', )
|
||||
@celery.app.task(name='ImportJob.run', filter=celery.task_method)
|
||||
def run(self, replace=False):
|
||||
try:
|
||||
|
|
|
@ -62,7 +62,15 @@ class TrackSerializer(LyricsMixin):
|
|||
tags = TagSerializer(many=True, read_only=True)
|
||||
class Meta:
|
||||
model = models.Track
|
||||
fields = ('id', 'mbid', 'title', 'artist', 'files', 'tags', 'lyrics')
|
||||
fields = (
|
||||
'id',
|
||||
'mbid',
|
||||
'title',
|
||||
'artist',
|
||||
'files',
|
||||
'tags',
|
||||
'position',
|
||||
'lyrics')
|
||||
|
||||
class TrackSerializerNested(LyricsMixin):
|
||||
artist = ArtistSerializer()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue