mirror of
https://github.com/tjsga/studyguides.git
synced 2025-04-05 03:40:16 -04:00
make searches case insensitive
This commit is contained in:
parent
4bde0cce90
commit
28dd5563a5
|
@ -35,10 +35,10 @@ def search_view(request):
|
||||||
if q:
|
if q:
|
||||||
q_list = q.split()
|
q_list = q.split()
|
||||||
context = {
|
context = {
|
||||||
"subject_results": Subject.objects.filter(reduce(operator.or_, (Q(name__contains=x) for x in q_list))),
|
"subject_results": Subject.objects.filter(reduce(operator.or_, (Q(name__icontains=x) for x in q_list))),
|
||||||
"course_results": [[c, c.subject.all()[0]] for c in Course.objects.filter(reduce(operator.or_, (Q(name__contains=x) for x in q_list)))],
|
"course_results": [[c, c.subject.all()[0]] for c in Course.objects.filter(reduce(operator.or_, (Q(name__icontains=x) for x in q_list)))],
|
||||||
"guide_results": Guide.objects.filter(reduce(operator.or_, (Q(name__contains=x) for x in q_list))),
|
"guide_results": Guide.objects.filter(reduce(operator.or_, (Q(name__icontains=x) for x in q_list))),
|
||||||
"tag_results": Tag.objects.filter(reduce(operator.or_, (Q(name__contains=x) for x in q_list))),
|
"tag_results": Tag.objects.filter(reduce(operator.or_, (Q(name__icontains=x) for x in q_list))),
|
||||||
"sq": q
|
"sq": q
|
||||||
}
|
}
|
||||||
return render(request, 'search_results.html', context=context)
|
return render(request, 'search_results.html', context=context)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user