summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCruiseDevice2020-09-10 22:07:55 +0530
committerankitjavalkar2020-10-08 10:42:50 +0530
commitc00575ae4b0d1bf128b98dd6319abf87357fee88 (patch)
tree64e57d0d2e7e8a1e8a609a86a6da907cd490d9ae
parent4d87a5eec1af36d32cc0daa4b6c1053a62712b7a (diff)
downloadonline_test-c00575ae4b0d1bf128b98dd6319abf87357fee88.tar.gz
online_test-c00575ae4b0d1bf128b98dd6319abf87357fee88.tar.bz2
online_test-c00575ae4b0d1bf128b98dd6319abf87357fee88.zip
Fix search in forum
- Also searches in post description.
-rw-r--r--yaksh/views.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/yaksh/views.py b/yaksh/views.py
index 803f1d6..ae00fc6 100644
--- a/yaksh/views.py
+++ b/yaksh/views.py
@@ -3483,9 +3483,11 @@ def course_forum(request, course_id):
raise Http404('You are not enrolled in {0} course'.format(course.name))
search_term = request.GET.get('search_post')
if search_term:
- # Fix this...
- posts = course.post.get_queryset().filter(
- active=True, title__icontains=search_term)
+ posts = Post.objects.filter(
+ Q(title__icontains=search_term) |
+ Q(description__icontains=search_term),
+ target_ct=course_ct, target_id=course.id, active=True
+ )
else:
posts = Post.objects.filter(
target_ct=course_ct, target_id=course.id, active=True