From c00575ae4b0d1bf128b98dd6319abf87357fee88 Mon Sep 17 00:00:00 2001 From: CruiseDevice Date: Thu, 10 Sep 2020 22:07:55 +0530 Subject: Fix search in forum - Also searches in post description. --- yaksh/views.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'yaksh') 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 -- cgit