From 34d600d9dfcbdfe364381277513aee432c466d2b Mon Sep 17 00:00:00 2001 From: Eliot Berriot Date: Thu, 18 Jul 2019 15:34:23 +0200 Subject: [PATCH] See #432: can now build custom radios using tags --- api/funkwhale_api/radios/filters.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/api/funkwhale_api/radios/filters.py b/api/funkwhale_api/radios/filters.py index 810673bd6..a92dbae88 100644 --- a/api/funkwhale_api/radios/filters.py +++ b/api/funkwhale_api/radios/filters.py @@ -178,9 +178,9 @@ class TagFilter(RadioFilter): "autocomplete_fields": { "remoteValues": "results", "name": "name", - "value": "slug", + "value": "name", }, - "autocomplete_qs": "query={query}", + "autocomplete_qs": "q={query}&ordering=length", "label": "Tags", "placeholder": "Select tags", } @@ -189,4 +189,8 @@ class TagFilter(RadioFilter): label = "Tag" def get_query(self, candidates, names, **kwargs): - return Q(tags__slug__in=names) + return ( + Q(tagged_items__tag__name__in=names) + | Q(artist__tagged_items__tag__name__in=names) + | Q(album__tagged_items__tag__name__in=names) + )