diff options
author | Prabhu Ramachandran | 2016-11-18 16:24:02 +0530 |
---|---|---|
committer | GitHub | 2016-11-18 16:24:02 +0530 |
commit | d88708631a568c37ae56602407a29001d97a982f (patch) | |
tree | f097d00b3378a7948e6289cdce733a37198bee24 /yaksh/views.py | |
parent | 6f2d4829d15d763177328400d0a1b857b983a770 (diff) | |
parent | 95c8c368d9f34cb05c5edd90f8697ec5d00c5a92 (diff) | |
download | online_test-d88708631a568c37ae56602407a29001d97a982f.tar.gz online_test-d88708631a568c37ae56602407a29001d97a982f.tar.bz2 online_test-d88708631a568c37ae56602407a29001d97a982f.zip |
Merge pull request #158 from adityacp/fix_file_upload_and_tooltip
Fix file upload and tooltip
Diffstat (limited to 'yaksh/views.py')
-rw-r--r-- | yaksh/views.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/yaksh/views.py b/yaksh/views.py index c3d743b..b6cf578 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.toggle_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')} |