This commit is contained in:
Ross
2020-12-28 19:29:20 +00:00
parent 238edf6358
commit 894bedd4d0
6 changed files with 20 additions and 4 deletions
+3
View File
@@ -275,6 +275,9 @@ class Exam(models.Model):
def __str__(self):
return self.name
def get_absolute_url(self):
return reverse("anatomy:exam_overview", kwargs={"pk": self.pk})
def get_exam_name(self):
return self.name
+8 -2
View File
@@ -94,6 +94,9 @@ class Question(models.Model):
if self.e:
self.e = self.e.strip()
def get_absolute_url(self):
return reverse("physics:question_detail", kwargs={"pk": self.pk})
def get_answers(self):
return (self.a_answer, self.b_answer, self.c_answer, self.d_answer, self.e_answer)
@@ -127,12 +130,15 @@ class Exam(models.Model):
def get_exam_name(self):
return self.name
def get_json_url(self):
return reverse("anatomy:exam_json", args=(self.pk,))
#def get_json_url(self):
# return reverse("anatomy:exam_json", args=(self.pk,))
def get_question_index(self, question):
return list(self.exam_questions.all()).index(question)
def get_absolute_url(self):
return reverse("physics:exam_overview", kwargs={"pk": self.pk})
class CidUserAnswer(models.Model):
"""User answers by candidate"""
+1
View File
@@ -8,6 +8,7 @@
<link rel="stylesheet" href="{% static 'css/anatomy.css' %}">
<link rel="stylesheet" href="{% static 'css/toastr.min.css' %}">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"> </script>
<script src="{% static 'js/toastr.min.js' %}"></script>
<script src="{% static 'js/cornerstone/hammer.js' %}"></script>
<script src="{% static 'js/cornerstone/cornerstone.min.js' %}"></script>
+5 -1
View File
@@ -14,7 +14,9 @@
Publish results: <input type="checkbox" id="exam-publish-results-switch" {% if exam.publish_results %}checked{% endif %}> <span class="help-text">[When checked the exam results will be available on this site]</span>
</div>
<!--<p><button><a href="{% url 'anatomy:exam_take' pk=exam.pk sk=0 %}">Click here to start</a></button></p>-->
This exam will be available to take <a href="{% url 'physics:exam_take' pk=exam.pk %}">here</a>.
{% autoescape off %}
<ol id="full-question-list">
{% for question in questions.all %}
@@ -37,10 +39,12 @@
{{ question.e }}: {{ question.e_answer }}
</li>
</ol>
Category: {{ question.category }}, <a href="{% url 'physics:question_detail' pk=question.pk %}">View</a>
Category: {{ question.category }}, <a href="{% url 'physics:question_detail' pk=question.pk %}">View</a> <a href="{% url 'admin:physics_question_change' question.id %}">Edit</a>
</li>
{% endfor %}
</ol>
{% endautoescape %}
</div>
<script type="text/javascript">
@@ -7,6 +7,7 @@
<div class="date">
Created: {{ question.created_date }}
</div>
{% autoescape off %}
<h2>{{question.stem}}</h2>
<div>
<ol>
@@ -17,6 +18,7 @@
<li>{{ question.e }}: {{ question.e_answer }}</li>
</ol>
</div>
{% endautoescape %}
<div>
Examinations: {% for exam in question.exams.all %}
<a href="{% url 'physics:exam_overview' pk=exam.pk %}">{{ exam.name }}</a>
+1 -1
View File
@@ -5,7 +5,7 @@
<title>Penra Courses</title>
<link rel="stylesheet" href="{% static 'css/anatomy.css' %}">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"> </script>
</head>