From 7f815f58c6af4b5020fba0dc490c8e7f9d328589 Mon Sep 17 00:00:00 2001 From: ankitjavalkar Date: Tue, 7 Mar 2017 16:05:40 +0530 Subject: Hide inactive/deleted questions in Questionpaper creation and question filter --- yaksh/views.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/yaksh/views.py b/yaksh/views.py index 74c409c..4c53d69 100644 --- a/yaksh/views.py +++ b/yaksh/views.py @@ -771,7 +771,7 @@ def ajax_questions_filter(request): """Ajax call made when filtering displayed questions.""" user = request.user - filter_dict = {"user_id": user.id} + filter_dict = {"user_id": user.id, "active": True} question_type = request.POST.get('question_type') marks = request.POST.get('marks') language = request.POST.get('language') @@ -795,7 +795,10 @@ def _get_questions(user, question_type, marks): if question_type is None and marks is None: return None if question_type: - questions = Question.objects.filter(type=question_type, user=user) + questions = Question.objects.filter(type=question_type, + user=user, + active=True + ) if marks: questions = questions.filter(points=marks) return questions -- cgit