From: Jan Szejko Date: Fri, 15 Dec 2017 09:43:22 +0000 (+0100) Subject: better default limit in search hint X-Git-Url: https://git.mdrn.pl/wolnelektury.git/commitdiff_plain/a73444333e9557df72656fd1f49c01933ff21348 better default limit in search hint --- 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 += [