This commit is contained in:
Ross
2020-12-27 23:17:17 +00:00
parent 4f8aaefea2
commit 22dd3aeaac
5 changed files with 33 additions and 2 deletions
+1 -1
View File
@@ -146,7 +146,7 @@ button a {
}
#dicom-image {
width: 60%;
width: 100%;
height: 600px;
}
+1 -1
View File
@@ -25,7 +25,7 @@
<br />
{{ question.question_type }}: {{ question.GetPrimaryAnswer }}
<br />
Modality: {{ question.modality }}, <a href="{% url 'anatomy:question_detail' pk=question.pk %}">View</a>
Modality: {{ question.modality }}, <a href="{% url 'anatomy:exam_question_detail' pk=exam.pk sk=forloop.counter0 %}">View</a>
</li>
{% endfor %}
</ol>
@@ -2,6 +2,18 @@
{% block content %}
{% load static %}
{% if exam %}
<div>
{% if previous > -1 %}
<a href="{% url 'anatomy:exam_question_detail' exam.id previous %}">Previous question</a>
{% endif %}
This question is part of exam: {{exam.name}}
{% if next %}
<a href="{% url 'anatomy:exam_question_detail' exam.id next %}">Next question</a>
{% endif %}
</div>
{% endif %}
<button id="save-annotations">Save Annotations</button>
<div id="dicom-image" data-url="{{ question.image.url}}" data-annotations='{{question.image_annotations}}' data-edit_annotation=true></div>
<!-- testing -->
+1
View File
@@ -18,6 +18,7 @@ urlpatterns = [
path("exam/<int:pk>/<int:sk>/mark", views.mark, name="mark"),
path("exam/<int:pk>/mark", views.mark_overview, name="mark_overview"),
path("exam/<int:pk>/<int:sk>/", views.exam_take, name="exam_take"),
path("exam/<int:pk>/question/<int:sk>/", views.exam_question_detail, name="exam_question_detail"),
path("exam/<int:pk>/", views.exam_overview, name="exam_overview"),
path("exam/<int:pk>/scores", views.exam_scores_cid,
name="exam_scores_cid"),
+18
View File
@@ -105,8 +105,26 @@ def index(request):
@login_required
def question_detail(request, pk):
question = get_object_or_404(AnatomyQuestion, pk=pk)
return render(request, "anatomy/question_detail.html", {"question": question})
@login_required
def exam_question_detail(request, pk, sk):
exam = get_object_or_404(Exam, pk=pk)
question = exam.exam_questions.all()[sk]
exam_length = len(exam.exam_questions.all())
previous = -1
if sk > 0:
previous = sk-1
next = sk+1
if sk == exam_length-1:
next = False
return render(request, "anatomy/question_detail.html", {"question": question, "exam": exam, "next" : next, "previous" : previous, "exam_length" : exam_length})
@login_required
def answer_question(request, pk):