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