diff options
author | CruiseDevice | 2020-09-10 22:07:55 +0530 |
---|---|---|
committer | ankitjavalkar | 2020-10-08 10:42:50 +0530 |
commit | c00575ae4b0d1bf128b98dd6319abf87357fee88 (patch) | |
tree | 64e57d0d2e7e8a1e8a609a86a6da907cd490d9ae /yaksh | |
parent | 4d87a5eec1af36d32cc0daa4b6c1053a62712b7a (diff) | |
download | online_test-c00575ae4b0d1bf128b98dd6319abf87357fee88.tar.gz online_test-c00575ae4b0d1bf128b98dd6319abf87357fee88.tar.bz2 online_test-c00575ae4b0d1bf128b98dd6319abf87357fee88.zip |
Fix search in forum
- Also searches in post description.
Diffstat (limited to 'yaksh')
-rw-r--r-- | yaksh/views.py | 8 |
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 |