diff options
author | adityacp | 2020-04-12 10:54:54 +0530 |
---|---|---|
committer | adityacp | 2020-04-12 10:54:54 +0530 |
commit | 9b7c8c7f6eb3e93f1bc28d118da165a7c600cbb3 (patch) | |
tree | b4d85eb827566ee767bff9529978e5b01c6b2d9e /yaksh/views.py | |
parent | 9cc5865251e896a6be54669ddc4c53c70eaef5ac (diff) | |
download | online_test-9b7c8c7f6eb3e93f1bc28d118da165a7c600cbb3.tar.gz online_test-9b7c8c7f6eb3e93f1bc28d118da165a7c600cbb3.tar.bz2 online_test-9b7c8c7f6eb3e93f1bc28d118da165a7c600cbb3.zip |
Fix search courses
Diffstat (limited to 'yaksh/views.py')
-rw-r--r-- | yaksh/views.py | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/yaksh/views.py b/yaksh/views.py index 336fdee..1d7a8c6 100644 --- a/yaksh/views.py +++ b/yaksh/views.py @@ -1072,19 +1072,18 @@ def courses(request): form = SearchFilterForm() - if request.method == 'POST': - course_tags = request.POST.get('search_tags') - course_status = request.POST.get('search_status') - - if course_status == 'select' : - courses = courses.filter( - name__contains=course_tags) - elif course_status == 'active' : - courses = courses.filter( - name__contains=course_tags, active=True) - elif course_status == 'closed': - courses = courses.filter( - name__contains=course_tags, active=False) + course_tags = request.GET.get('search_tags') + course_status = request.GET.get('search_status') + + if course_status == 'select' and course_tags: + courses = courses.filter( + name__icontains=course_tags) + elif course_status == 'active' : + courses = courses.filter( + name__icontains=course_tags, active=True) + elif course_status == 'closed': + courses = courses.filter( + name__icontains=course_tags, active=False) paginator = Paginator(courses, 30) page = request.GET.get('page') |