From a73444333e9557df72656fd1f49c01933ff21348 Mon Sep 17 00:00:00 2001 From: Jan Szejko Date: Fri, 15 Dec 2017 10:43:22 +0100 Subject: [PATCH] better default limit in search hint --- src/search/views.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/search/views.py b/src/search/views.py index b0f064119..8542e512f 100644 --- a/src/search/views.py +++ b/src/search/views.py @@ -71,10 +71,10 @@ def hint(request): try: limit = int(request.GET.get('max', '')) except ValueError: - limit = -1 + limit = 20 else: if limit < 1: - limit = -1 + limit = 20 data = [ { @@ -83,7 +83,7 @@ def hint(request): 'id': author.id, 'url': author.get_absolute_url(), } - for author in Tag.objects.filter(category='author', name__iregex=u'\m' + prefix)[:10] + for author in Tag.objects.filter(category='author', name__iregex=u'\m' + prefix)[:limit] ] if len(data) < limit: data += [ -- 2.20.1