add function to get exam index from list

This commit is contained in:
Ross
2020-12-14 14:20:50 +00:00
parent 95f901a349
commit 7ddea6df99
2 changed files with 4 additions and 1 deletions
+3
View File
@@ -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(