From fd976735d6c25f454251278a18f80589a58fb100 Mon Sep 17 00:00:00 2001 From: root Date: Tue, 19 Dec 2017 12:26:04 +0000 Subject: [PATCH] ignore case --- content/views.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/content/views.py b/content/views.py index 847155a..02acfc7 100644 --- a/content/views.py +++ b/content/views.py @@ -125,7 +125,9 @@ def page(request, shortname): def search(request): q = request.GET.get('q') - results = Content.objects.filter(Q(body__contains=q) | Q(title__contains=q)).distinct().order_by('-datestart') + results = Content.objects.filter(Q(body__icontains=q) | Q(title__icontains=q)).distinct() + results = results.filter(published=True) + results = results.order_by('-datestart') page = request.GET.get('page', 1) paginator = Paginator(results, 5) try: