diff options
Diffstat (limited to 'yaksh')
-rw-r--r-- | yaksh/templates/yaksh/download_questionpaper.html | 38 | ||||
-rw-r--r-- | yaksh/urls.py | 3 | ||||
-rw-r--r-- | yaksh/views.py | 18 |
3 files changed, 59 insertions, 0 deletions
diff --git a/yaksh/templates/yaksh/download_questionpaper.html b/yaksh/templates/yaksh/download_questionpaper.html new file mode 100644 index 0000000..8b04874 --- /dev/null +++ b/yaksh/templates/yaksh/download_questionpaper.html @@ -0,0 +1,38 @@ +{% extends "base.html" %} + +{% block pagetitle %} Quiz: {{ paper.quiz.description }} {% endblock pagetitle %} + +{% block content %} +<div class="well"> + <div class="col-md-12"> + <div class="col-md-6">Maximum Mark(s): {{ paper.total_marks }}</div> + <div class="col-md-6"><span class="pull-right">Total Time: {{ paper.quiz.duration }}</span></div> + </div> +</div> +<div class="panel panel-default"> + <div class="panel-heading">Instructions</div> + <div class="panel-body" id="instructions"> + {{ paper.quiz.instructions|safe }} + </div> +</div> +{% for question in questions %} + <div class="panel panel-info"> + <div class="panel-heading"> + <strong> {{forloop.counter}}. {{ question.summary }} + <span class="marks pull-right"> Mark(s): {{ question.points }} </span> + </strong> + </div> + <div class="panel-body"> + <h5><u>Question:</u></h5> <strong>{{ question.description|safe }}</strong> + {% if question.type == "mcq" or question.type == "mcc" %} + <h5> <u>Choices:</u></h5> + {% for testcase in question.get_test_cases %} + <br/><strong> + {{ forloop.counter }}. {{ testcase.options|safe }}</strong> + {% endfor %} + {% endif %} + + </div> + </div> +{% endfor %} +{% endblock %} diff --git a/yaksh/urls.py b/yaksh/urls.py index 08c2091..3120705 100644 --- a/yaksh/urls.py +++ b/yaksh/urls.py @@ -140,6 +140,7 @@ urlpatterns = [ views.download_assignment_file, name="download_quiz_assignment"), url(r'^manage/courses/download_yaml_template/', views.download_yaml_template, name="download_yaml_template"), +<<<<<<< HEAD url(r'^manage/download_sample_csv/', views.download_sample_csv, name="download_sample_csv"), url(r'^manage/courses/edit_lesson/$', @@ -172,4 +173,6 @@ urlpatterns = [ views.design_course, name="design_course"), url(r'^manage/course_status/(?P<course_id>\d+)/$', views.course_status, name="course_status"), + url(r'^manage/download_questionpaper/(?P<questionpaper_id>\d+)/$', + views.download_questionpaper, name="download_questionpaper"), ] diff --git a/yaksh/views.py b/yaksh/views.py index 011b417..0dab227 100644 --- a/yaksh/views.py +++ b/yaksh/views.py @@ -9,6 +9,7 @@ from django.core.urlresolvers import reverse from django.contrib.auth import login, logout, authenticate from django.shortcuts import render_to_response, get_object_or_404, redirect from django.template import RequestContext, Context, Template +from django.template.loader import get_template, render_to_string from django.http import Http404 from django.db.models import Sum, Max, Q, F from django.views.decorators.csrf import csrf_exempt @@ -2744,3 +2745,20 @@ def _update_unit_status(course_id, user, unit): # make next available unit as current unit course_status.current_unit = unit course_status.save() + + +@login_required +@email_verified +def download_questionpaper(request, questionpaper_id): + user = request.user + if not is_moderator(user): + raise Http404('You are not allowed to view this page!') + paper = QuestionPaper.objects.get(id=questionpaper_id) + context = { + 'questions': paper._get_questions_for_answerpaper(), + 'paper': paper, + } + + return my_render_to_response( + 'yaksh/download_questionpaper.html', context + ) |