summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--yaksh/templates/yaksh/courses.html18
-rw-r--r--yaksh/views.py4
2 files changed, 18 insertions, 4 deletions
diff --git a/yaksh/templates/yaksh/courses.html b/yaksh/templates/yaksh/courses.html
index c304e1a..60e6bf4 100644
--- a/yaksh/templates/yaksh/courses.html
+++ b/yaksh/templates/yaksh/courses.html
@@ -131,19 +131,31 @@
</div>
</div>
</div>
- <div class="col-md-4">
+ <div>
<p><b><a href="{{URL_ROOT}}/exam/manage/searchteacher/{{course.id}}/">Add Teacher</a></b></p>
</div>
- <div class="col-md-4">
+ <div class="col-md-2">
<p><b><u>Quiz(zes)</u></b></p>
{% if course.get_quizzes %}
{% for quiz in course.get_quizzes %}
<a href="{{URL_ROOT}}/exam/manage/addquiz/{{course.id}}/{{quiz.id}}/">{{ quiz.description }}</a><br>
- {% endfor %}
+ {% endfor %}
{% else %}
<p><b>No quiz </b></p>
{% endif %}
</div>
+ <div class="col-md-4">
+ <p><b><u>Question Paper(s)</u></b></p>
+ {% for quiz in course.get_quizzes %}
+ {% if quiz.questionpaper_set.get %}
+ <a href="{{URL_ROOT}}/exam/manage/designquestionpaper/{{ quiz.id }}/{{quiz.questionpaper_set.get.id}}/">Question Paper for {{ quiz.description }}</a><br>
+ {% else %}
+ <p>No Question Paper
+ <a href="#" onClick='location.replace("{{URL_ROOT}}/exam/manage/quiz/designquestionpaper/{{ quiz.id }}/");'>Add</a>
+ </p>
+ {% endif %}
+ {% endfor %}
+ </div>
</div>
<br/>
<button class="btn btn-primary pull-right"type="button" onClick='location.replace("{{URL_ROOT}}/exam/manage/addquiz/{{course.id}}/");'>Add New Quiz</button>
diff --git a/yaksh/views.py b/yaksh/views.py
index 275cb6f..db7498c 100644
--- a/yaksh/views.py
+++ b/yaksh/views.py
@@ -874,7 +874,9 @@ def design_questionpaper(request, quiz_id, questionpaper_id=None):
if not is_moderator(user):
raise Http404('You are not allowed to view this page!')
-
+ quiz = Quiz.objects.get(id=quiz_id)
+ if not quiz.course.is_creator(user) and not quiz.course.is_teacher(user):
+ raise Http404('This course does not belong to you')
filter_form = QuestionFilterForm(user=user)
questions = None
marks = None