summaryrefslogtreecommitdiff
path: root/yaksh/views.py
diff options
context:
space:
mode:
authorPrabhu Ramachandran2016-10-21 23:12:10 +0530
committerGitHub2016-10-21 23:12:10 +0530
commitadae38cb47d8c36280f2e6cd40ccade3ce1108c5 (patch)
tree5a5f9b294e4cbf19a560786bdd8e47a93a961dec /yaksh/views.py
parent9b60cc7b8f000f96d5f818f759a6c63d5a26f239 (diff)
parentd33e97e4081037d92f89c7ae5742f74411b51931 (diff)
downloadonline_test-adae38cb47d8c36280f2e6cd40ccade3ce1108c5.tar.gz
online_test-adae38cb47d8c36280f2e6cd40ccade3ce1108c5.tar.bz2
online_test-adae38cb47d8c36280f2e6cd40ccade3ce1108c5.zip
Merge pull request #147 from ankitjavalkar/no-delete-question
Hide questions instead of deletion
Diffstat (limited to 'yaksh/views.py')
-rw-r--r--yaksh/views.py12
1 files changed, 5 insertions, 7 deletions
diff --git a/yaksh/views.py b/yaksh/views.py
index 049788a..270a47c 100644
--- a/yaksh/views.py
+++ b/yaksh/views.py
@@ -915,12 +915,10 @@ def show_all_questions(request):
if request.POST.get('delete') == 'delete':
data = request.POST.getlist('question')
if data is not None:
- questions = Question.objects.filter(id__in=data, user_id=user.id)
- files = FileUpload.objects.filter(question_id__in=questions)
- if files:
- for file in files:
- file.remove()
- questions.delete()
+ questions = Question.objects.filter(id__in=data, user_id=user.id, active=True)
+ for question in questions:
+ question.active = False
+ question.save()
if request.POST.get('upload') == 'upload':
form = UploadFileForm(request.POST, request.FILES)
@@ -959,7 +957,7 @@ def show_all_questions(request):
else:
context["msg"] = "Please select atleast one question to test"
- questions = Question.objects.filter(user_id=user.id)
+ questions = Question.objects.filter(user_id=user.id, active=True)
form = QuestionFilterForm(user=user)
upload_form = UploadFileForm()
context['papers'] = []