also search in title

This commit is contained in:
j 2017-12-19 13:23:57 +01:00
parent 9f33c16619
commit e56f40d991

View File

@ -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: