X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/aa20c637378d84ac13f7820662792cb69ffe0826..39c7b0bdbe5157ba606196042b2a7309d492eca0:/src/search/views.py?ds=sidebyside diff --git a/src/search/views.py b/src/search/views.py index 01abfc526..6066cd97a 100644 --- a/src/search/views.py +++ b/src/search/views.py @@ -36,6 +36,8 @@ def get_hints(prefix, user=None, limit=10): 'label': author.name, 'url': author.get_absolute_url(), 'img': get_thumbnail(author.photo, '72x72', crop='top').url if author.photo else '', + 'slug': author.slug, + 'id': author.id, } for author in authors[:limit - len(data)] ]) @@ -45,9 +47,10 @@ def get_hints(prefix, user=None, limit=10): user=user, name__iregex='\m' + prefix).only('name', 'id', 'slug') data.extend([ { - 'type': 'set', + 'type': 'userlist', 'label': tag.name, 'url': tag.get_absolute_url(), + 'slug': tag.slug, } for tag in tags[:limit - len(data)] ]) @@ -59,6 +62,8 @@ def get_hints(prefix, user=None, limit=10): 'type': tag.category, 'label': tag.name, 'url': tag.get_absolute_url(), + 'slug': tag.slug, + 'id': tag.id, } for tag in tags[:limit - len(data)] ]) @@ -70,6 +75,7 @@ def get_hints(prefix, user=None, limit=10): 'type': 'collection', 'label': collection.title, 'url': collection.get_absolute_url(), + 'slug': collection.slug, } for collection in collections[:limit - len(data)] ]) @@ -86,6 +92,7 @@ def get_hints(prefix, user=None, limit=10): 'author': author_str, 'url': b.get_absolute_url(), 'img': get_thumbnail(b.cover_clean, '72x72').url if b.cover_clean else '', + 'slug': b.slug, } ) if len(data) < limit: @@ -98,6 +105,7 @@ def get_hints(prefix, user=None, limit=10): 'type': 'info', 'label': info.title, 'url': info.get_absolute_url(), + 'slug': info.slug, } for info in infos[:limit - len(data)] ])