See #432: can now build custom radios using tags

environments/review-front-arti-0habim/deployments/2230
Eliot Berriot 2019-07-18 15:34:23 +02:00
rodzic e21e0e50d1
commit 34d600d9df
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: DD6965E2476E5C27
1 zmienionych plików z 7 dodań i 3 usunięć

Wyświetl plik

@ -178,9 +178,9 @@ class TagFilter(RadioFilter):
"autocomplete_fields": { "autocomplete_fields": {
"remoteValues": "results", "remoteValues": "results",
"name": "name", "name": "name",
"value": "slug", "value": "name",
}, },
"autocomplete_qs": "query={query}", "autocomplete_qs": "q={query}&ordering=length",
"label": "Tags", "label": "Tags",
"placeholder": "Select tags", "placeholder": "Select tags",
} }
@ -189,4 +189,8 @@ class TagFilter(RadioFilter):
label = "Tag" label = "Tag"
def get_query(self, candidates, names, **kwargs): 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)
)