This commit is contained in:
Ross
2021-05-03 19:31:04 +01:00
parent 606475e1b7
commit d9f0536e07
2 changed files with 9 additions and 2 deletions
+7 -1
View File
@@ -98,6 +98,8 @@ class ExamBase(models.Model):
def get_question_index(self, question):
return list(self.exam_questions.all()).index(question)
class NoteType(models.Model):
note_type = models.CharField(max_length=200)
class QuestionNote(models.Model):
content_type = models.ForeignKey(ContentType, on_delete=models.CASCADE)
@@ -109,9 +111,13 @@ class QuestionNote(models.Model):
note = models.TextField()
created_on = models.DateTimeField(auto_now_add=True)
complete = models.BooleanField(default=False)
note_type = models.ForeignKey(NoteType, on_delete=models.CASCADE, null=True)
#def get_absolute_url(self):
# self.pk = self.rapid_id
# return reverse('rapids:question_detail', kwargs={'pk': self.pk})
def __str__(self):
return "{} [{}] {}".format(self.author, self.created_on, self.note)
return "{} [{}] {}".format(self.author, self.created_on, self.note_type, self.note)