summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorankitjavalkar2017-03-07 16:05:40 +0530
committerankitjavalkar2017-03-07 16:05:40 +0530
commit7f815f58c6af4b5020fba0dc490c8e7f9d328589 (patch)
treeff084d106e4648c0afd40ad5006b47965c2d56df
parentaede1c3736077387d63eacd20c2c39d8875e605d (diff)
downloadonline_test-7f815f58c6af4b5020fba0dc490c8e7f9d328589.tar.gz
online_test-7f815f58c6af4b5020fba0dc490c8e7f9d328589.tar.bz2
online_test-7f815f58c6af4b5020fba0dc490c8e7f9d328589.zip
Hide inactive/deleted questions in Questionpaper creation and question filter
-rw-r--r--yaksh/views.py7
1 files 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