mirror of
https://code.eliotberriot.com/funkwhale/funkwhale.git
synced 2025-10-05 03:39:25 +02:00
Fix #895: "Display tracks count instead of albums count for artists with no albums"
This commit is contained in:
parent
7e8e21e1d1
commit
2e0883d44c
7 changed files with 26 additions and 7 deletions
|
@ -94,7 +94,11 @@ def refetch_obj(obj, queryset):
|
|||
|
||||
|
||||
class ArtistViewSet(common_views.SkipFilterForGetObject, viewsets.ReadOnlyModelViewSet):
|
||||
queryset = models.Artist.objects.all().select_related("attributed_to")
|
||||
queryset = (
|
||||
models.Artist.objects.all()
|
||||
.select_related("attributed_to")
|
||||
.annotate(_tracks_count=Count("tracks"))
|
||||
)
|
||||
serializer_class = serializers.ArtistWithAlbumsSerializer
|
||||
permission_classes = [oauth_permissions.ScopePermission]
|
||||
required_scope = "libraries"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue