.
This commit is contained in:
@@ -1,11 +1,14 @@
|
||||
{% extends 'anatomy/base.html' %}
|
||||
|
||||
{% block content %}
|
||||
{% for exam in exams %}
|
||||
<div class="anatomy">
|
||||
<h1><a href="{% url 'anatomy:exam_overview' pk=exam.pk %}">Exam: {{ exam.name }} </a></h1>
|
||||
{% if request.user.is_staff %}<a href="{% url 'anatomy:mark' pk=exam.pk sk=0 %}">Mark answers</a>{% endif %}
|
||||
{% if request.user.is_staff %}<a href="{% url 'anatomy:exam_scores_cid' pk=exam.pk %}">Scores</a>{% endif %}
|
||||
</div>
|
||||
{% endfor %}
|
||||
{% endblock %}
|
||||
{% for exam in exams %}
|
||||
<div class="anatomy">
|
||||
<h1><a href="{% url 'anatomy:exam_overview' pk=exam.pk %}">Exam: {{ exam.name }} </a></h1>
|
||||
|
||||
{% if exam.exam_mode %}
|
||||
{% if request.user.is_staff %}<a href="{% url 'anatomy:mark' pk=exam.pk sk=0 %}">Mark answers</a>{% endif %}
|
||||
{% if request.user.is_staff %}<a href="{% url 'anatomy:exam_scores_cid' pk=exam.pk %}">Scores</a>{% endif %}
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endfor %}
|
||||
{% endblock %}
|
||||
|
||||
@@ -289,6 +289,14 @@ def loadJsonAnswer(answer):
|
||||
# # return render(request, "anatomy/exam.html", {"exam" : exam, "question" : question})
|
||||
|
||||
|
||||
@login_required
|
||||
def mark_all(request, exam_pk, sk):
|
||||
return mark(request, exam_pk, sk, unmarked_exam_answers_only=False)
|
||||
|
||||
@login_required
|
||||
def mark_review(request, exam_pk, sk):
|
||||
return mark(request, exam_pk, sk, unmarked_exam_answers_only=False, review=True)
|
||||
|
||||
# @user_passes_test(user_is_admin, login_url="/accounts/login")
|
||||
@login_required
|
||||
def mark(request, pk, sk):
|
||||
@@ -404,6 +412,9 @@ def mark(request, pk, sk):
|
||||
def exam_scores_cid(request, pk):
|
||||
exam = get_object_or_404(Exam, pk=pk)
|
||||
|
||||
if not exam.exam_mode:
|
||||
raise Http404("Packet not in exam mode")
|
||||
|
||||
questions = exam.exam_questions.all()
|
||||
|
||||
cids = (
|
||||
@@ -507,6 +518,9 @@ def exam_scores_cid(request, pk):
|
||||
def exam_scores_cid_user(request, pk, sk):
|
||||
exam = get_object_or_404(Exam, pk=pk)
|
||||
|
||||
if not exam.exam_mode:
|
||||
raise Http404("Packet not in exam mode")
|
||||
|
||||
# TODO:Need some kind of test for cid
|
||||
cid = sk
|
||||
|
||||
|
||||
@@ -438,6 +438,9 @@ class ExamViews(View, LoginRequiredMixin):
|
||||
def mark_overview(self, request, pk):
|
||||
exam = get_object_or_404(self.Exam, pk=pk)
|
||||
|
||||
if not exam.exam_mode:
|
||||
raise Http404("Packet not in exam mode")
|
||||
|
||||
if request.user not in exam.author.all():
|
||||
if not self.check_user_access(request.user, pk):
|
||||
raise PermissionDenied
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
{% extends 'rapids/base.html' %}
|
||||
|
||||
{% block content %}
|
||||
{% for exam in exams %}
|
||||
<div class="rapids">
|
||||
<h1><a href="{% url 'rapids:exam_overview' pk=exam.pk %}">Exam: {{ exam.name }} </a></h1>
|
||||
{% if request.user.is_staff %}<a href="{% url 'rapids:mark' exam_pk=exam.pk sk=0 %}">Mark answers</a>{% endif %}
|
||||
{% if request.user.is_staff %}<a href="{% url 'rapids:exam_scores_cid' pk=exam.pk %}">Scores</a>{% endif %}
|
||||
</div>
|
||||
{% endfor %}
|
||||
{% endblock %}
|
||||
{% for exam in exams %}
|
||||
<div class="rapids">
|
||||
<h1><a href="{% url 'rapids:exam_overview' pk=exam.pk %}">Exam: {{ exam.name }} </a></h1>
|
||||
{% if exam.exam_mode %}
|
||||
{% if request.user.is_staff %}<a href="{% url 'rapids:mark' exam_pk=exam.pk sk=0 %}">Mark answers</a>{% endif %}
|
||||
{% if request.user.is_staff %}<a href="{% url 'rapids:exam_scores_cid' pk=exam.pk %}">Scores</a>{% endif %}
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endfor %}
|
||||
{% endblock %}
|
||||
|
||||
+9
-1
@@ -581,6 +581,9 @@ def mark_review(request, exam_pk, sk):
|
||||
def mark(request, exam_pk, sk, unmarked_exam_answers_only=True, review=False):
|
||||
exam = get_object_or_404(Exam, pk=exam_pk)
|
||||
|
||||
if not exam.exam_mode:
|
||||
raise Http404("Packet not in exam mode")
|
||||
|
||||
mark_url = "rapids:mark"
|
||||
if review:
|
||||
mark_url = "rapids:mark_review"
|
||||
@@ -728,6 +731,9 @@ def mark(request, exam_pk, sk, unmarked_exam_answers_only=True, review=False):
|
||||
def exam_scores_cid(request, pk):
|
||||
exam = get_object_or_404(Exam, pk=pk)
|
||||
|
||||
if not exam.exam_mode:
|
||||
raise Http404("Packet not in exam mode")
|
||||
|
||||
questions = exam.exam_questions.all()
|
||||
|
||||
cids = (
|
||||
@@ -841,8 +847,10 @@ def exam_scores_cid(request, pk):
|
||||
def exam_scores_cid_user(request, pk, cid):
|
||||
exam = get_object_or_404(Exam, pk=pk)
|
||||
|
||||
if not exam.exam_mode:
|
||||
raise Http404("Packet not in exam mode")
|
||||
|
||||
# TODO:Need some kind of test for cid
|
||||
#cid = sk
|
||||
|
||||
questions = exam.exam_questions.all()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user