From e56f40d991bf06d259791bbd842789a7bf413608 Mon Sep 17 00:00:00 2001 From: j Date: Tue, 19 Dec 2017 13:23:57 +0100 Subject: [PATCH] also search in title --- content/views.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/views.py b/content/views.py index aead5b9..847155a 100644 --- a/content/views.py +++ b/content/views.py @@ -125,7 +125,7 @@ def page(request, shortname): def search(request): q = request.GET.get('q') - results = Content.objects.filter(body__contains=q).order_by('-datestart') + results = Content.objects.filter(Q(body__contains=q) | Q(title__contains=q)).distinct().order_by('-datestart') page = request.GET.get('page', 1) paginator = Paginator(results, 5) try: