diff options
author | ankitjavalkar | 2020-09-29 21:26:20 +0530 |
---|---|---|
committer | GitHub | 2020-09-29 21:26:20 +0530 |
commit | f9103b8e79b7f9a74d1d3e1d6ae2a458a383b270 (patch) | |
tree | 984b12be5c2865f8870ac47d60d31050b04f2416 /yaksh | |
parent | f6c687c4374038a0c6be27a4db4bc3f06817216a (diff) | |
parent | be55d8d11098ce7fa2b9cfc3e2e7bb0d5bc8efc2 (diff) | |
download | online_test-f9103b8e79b7f9a74d1d3e1d6ae2a458a383b270.tar.gz online_test-f9103b8e79b7f9a74d1d3e1d6ae2a458a383b270.tar.bz2 online_test-f9103b8e79b7f9a74d1d3e1d6ae2a458a383b270.zip |
Merge pull request #770 from ankitjavalkar/add_file_namer
Display file names of uploaded files in question files
Diffstat (limited to 'yaksh')
-rw-r--r-- | yaksh/templates/yaksh/question.html | 9 | ||||
-rw-r--r-- | yaksh/views.py | 9 |
2 files changed, 18 insertions, 0 deletions
diff --git a/yaksh/templates/yaksh/question.html b/yaksh/templates/yaksh/question.html index 3f7e67e..2dbfeed 100644 --- a/yaksh/templates/yaksh/question.html +++ b/yaksh/templates/yaksh/question.html @@ -276,6 +276,15 @@ question_type = "{{ question.type }}"; {% if question.type == "upload" %} <p>Upload assignment file for the said question<p> <input type=file id="assignment" name="assignment" multiple=""> + {% if assignment_files %} + <ul class="list-group"> + {% for as_file in assignment_files %} + <li class="list-group-item"> + <a href="{{as_file.assignmentFile.url}}" target="_blank">{{ as_file.assignmentFile.name|file_title }}</a> + </li> + {% endfor %} + </ul> + {% endif %} {% endif %} <!-- Arrange type question --> diff --git a/yaksh/views.py b/yaksh/views.py index 41f367d..859ce3b 100644 --- a/yaksh/views.py +++ b/yaksh/views.py @@ -668,6 +668,7 @@ def show_question(request, question, paper, error_message=None, quiz = paper.question_paper.quiz quiz_type = 'Exam' can_skip = False + assignment_files = [] if previous_question: delay_time = paper.time_left_on_question(previous_question) else: @@ -709,6 +710,13 @@ def show_question(request, question, paper, error_message=None, test_cases = question.get_ordered_test_cases(paper) else: test_cases = question.get_test_cases() + if question.type == 'upload': + assignment_files = AssignmentUpload.objects.filter( + assignmentQuestion_id=question.id, + course_id=course_id, + user=request.user, + question_paper_id=paper.question_paper_id + ) files = FileUpload.objects.filter(question_id=question.id, hide=False) course = Course.objects.get(id=course_id) module = course.learning_module.get(id=module_id) @@ -728,6 +736,7 @@ def show_question(request, question, paper, error_message=None, 'delay_time': delay_time, 'quiz_type': quiz_type, 'all_modules': all_modules, + 'assignment_files': assignment_files, } answers = paper.get_previous_answers(question) if answers: |