This commit is contained in:
Ross
2021-05-03 19:08:55 +01:00
parent 90e8de2b07
commit 818afe0fe5
4 changed files with 52 additions and 4 deletions
+22 -1
View File
@@ -8,6 +8,9 @@ import tagulous.models
from sortedm2m.fields import SortedManyToManyField
from django.conf import settings
from django.contrib.contenttypes.fields import GenericForeignKey
from django.contrib.contenttypes.models import ContentType
class Plane(models.Model):
plane = models.CharField(max_length=200)
@@ -93,4 +96,22 @@ class ExamBase(models.Model):
return reverse("{}:exam_json".format(self.app_name), args=(self.pk,))
def get_question_index(self, question):
return list(self.exam_questions.all()).index(question)
return list(self.exam_questions.all()).index(question)
class QuestionNote(models.Model):
content_type = models.ForeignKey(ContentType, on_delete=models.CASCADE)
object_id = models.PositiveIntegerField()
question = GenericForeignKey('content_type', 'object_id')
#author = models.ForeignKey(User,
author = models.CharField(max_length=200, blank=True)
note = models.TextField()
created_on = models.DateTimeField(auto_now_add=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)