fnp
/
wolnelektury.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
032a2b1
)
better default limit in search hint
author
Jan Szejko
<janek37@gmail.com>
Fri, 15 Dec 2017 09:43:22 +0000
(10:43 +0100)
committer
Jan Szejko
<janek37@gmail.com>
Fri, 15 Dec 2017 09:43:22 +0000
(10:43 +0100)
src/search/views.py
patch
|
blob
|
history
diff --git
a/src/search/views.py
b/src/search/views.py
index
b0f0641
..
8542e51
100644
(file)
--- 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:
try:
limit = int(request.GET.get('max', ''))
except ValueError:
- limit =
-1
+ limit =
20
else:
if limit < 1:
else:
if limit < 1:
- limit =
-1
+ limit =
20
data = [
{
data = [
{
@@
-83,7
+83,7
@@
def hint(request):
'id': author.id,
'url': author.get_absolute_url(),
}
'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 += [
]
if len(data) < limit:
data += [