add function to get exam index from list
This commit is contained in:
@@ -275,6 +275,9 @@ class Exam(models.Model):
|
||||
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)
|
||||
|
||||
|
||||
class UserAnswer(models.Model):
|
||||
question = models.ForeignKey(
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
{% if unmarked %}
|
||||
The following questions need marking
|
||||
{% for question in unmarked %}
|
||||
<a href="{% url 'anatomy:mark' exam.pk question.pk %}">{{question.pk}}</a>
|
||||
<a href="{% url 'anatomy:mark' exam.pk question.pk %}">{{ exam|get_question_index:question }}</a>
|
||||
{% endfor %}
|
||||
|
||||
{% endif %}
|
||||
|
||||
Reference in New Issue
Block a user