mirror of
https://code.eliotberriot.com/funkwhale/funkwhale.git
synced 2025-10-04 13:19:16 +02:00
See #50: pagination, search and ordering on artist browsing
This commit is contained in:
parent
860b6b1e1f
commit
04c70116c3
8 changed files with 124 additions and 20 deletions
|
@ -47,16 +47,15 @@ class TagViewSetMixin(object):
|
|||
class ArtistViewSet(SearchMixin, viewsets.ReadOnlyModelViewSet):
|
||||
queryset = (
|
||||
models.Artist.objects.all()
|
||||
.order_by('name')
|
||||
.prefetch_related(
|
||||
'albums__tracks__files',
|
||||
'albums__tracks__artist',
|
||||
'albums__tracks__tags'))
|
||||
serializer_class = serializers.ArtistSerializerNested
|
||||
permission_classes = [ConditionalAuthentication]
|
||||
search_fields = ['name']
|
||||
ordering_fields = ('creation_date', 'name')
|
||||
filter_class = filters.ArtistFilter
|
||||
|
||||
ordering_fields = ('id', 'name', 'creation_date')
|
||||
|
||||
class AlbumViewSet(SearchMixin, viewsets.ReadOnlyModelViewSet):
|
||||
queryset = (
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue