Skip to content
This repository was archived by the owner on Nov 8, 2018. It is now read-only.

Commit 61b6748

Browse files
authored
Merge pull request #341 from GunpreetAhuja/search_improvement
Made search case-insensitive and improved it
2 parents a75bb11 + eda747b commit 61b6748

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

templates/ui/result.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@ <h2 class="text-center">
1818
<h3>Category</h3>
1919
</th>
2020
{% endif %}
21-
<th class="col-sm-1">
21+
<th class="col-sm-2">
2222
<h3>Post</h3>
2323
</th>
2424
<th class="col-sm-4">
2525
<h3>Description</h3>
2626
</th>
27-
<th class="col-sm-2">
27+
<th class="col-sm-3">
2828
<h3></h3>
2929
</th>
3030
<th class="col-sm-1">

webhub/views.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -162,15 +162,15 @@ def get_queryset(self):
162162

163163
if query:
164164
if category == 'pcsa':
165-
result = ghnPost.objects.filter(title__contains=query)
165+
result = ghnPost.objects.filter(title__icontains=query)
166166
elif category == 'pcsa_safety_tools':
167-
result = SafetyToolsPost.objects.filter(title__contains=query)
167+
result = SafetyToolsPost.objects.filter(title__icontains=query)
168168
elif category == 'malaria':
169-
result = Post.objects.filter(title_post__contains=query)
169+
result = Post.objects.filter(title_post__icontains=query)
170170
else:
171-
result = chain(Post.objects.filter(title_post__contains=query),
172-
ghnPost.objects.filter(title__contains=query),
173-
SafetyToolsPost.objects.filter(title__contains=query))
171+
result = list(chain(Post.objects.filter(title_post__icontains=query),
172+
ghnPost.objects.filter(title__icontains=query),
173+
SafetyToolsPost.objects.filter(title__icontains=query)))
174174
return result
175175

176176
def get_context_data(self, **kwargs):

0 commit comments

Comments
 (0)