summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoradityacp2016-11-18 09:29:06 +0530
committeradityacp2016-11-18 09:29:06 +0530
commitd3ee68891f96642262c8ec3765f69a3a3f3f39a7 (patch)
tree3835577a701fae7f3354b09d745e8d8cca3fc7ad
parent8795caf686549e793d0e422c328c93832077857f (diff)
downloadonline_test-d3ee68891f96642262c8ec3765f69a3a3f3f39a7.tar.gz
online_test-d3ee68891f96642262c8ec3765f69a3a3f3f39a7.tar.bz2
online_test-d3ee68891f96642262c8ec3765f69a3a3f3f39a7.zip
changed views to get only unhided files
-rw-r--r--yaksh/views.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/yaksh/views.py b/yaksh/views.py
index c3d743b..2eeef90 100644
--- a/yaksh/views.py
+++ b/yaksh/views.py
@@ -182,6 +182,7 @@ def edit_question(request, question_id=None):
form = FileForm(request.POST, request.FILES)
files = request.FILES.getlist('file_field')
extract_files_id = request.POST.getlist('extract')
+ hide_files_id = request.POST.getlist('hide')
if files:
for file in files:
FileUpload.objects.get_or_create(question=question_instance, file=file)
@@ -189,6 +190,10 @@ def edit_question(request, question_id=None):
files = FileUpload.objects.filter(id__in=extract_files_id)
for file in files:
file.set_extract_status()
+ if hide_files_id:
+ files = FileUpload.objects.filter(id__in=hide_files_id)
+ for file in files:
+ file.set_hide_status()
if question_form.is_valid():
new_question = question_form.save(commit=False)
test_case_type = question_form.cleaned_data.get('test_case_type')
@@ -432,7 +437,7 @@ def show_question(request, question, paper, error_message=None):
reason='Your time is up!'
return complete(request, reason, paper.attempt_number, paper.question_paper.id)
test_cases = question.get_test_cases()
- files = FileUpload.objects.filter(question_id=question.id)
+ files = FileUpload.objects.filter(question_id=question.id, hide=False)
context = {'question': question, 'paper': paper, 'error_message': error_message,
'test_cases': test_cases, 'files': files,
'last_attempt': question.snippet.encode('unicode-escape')}