This commit is contained in:
Ross
2021-09-21 18:44:16 +01:00
parent c7e298333e
commit 9881e8bd56
3 changed files with 9 additions and 3 deletions
+4 -1
View File
@@ -1,3 +1,4 @@
from django.contrib.contenttypes.fields import GenericRelation
from django.db import models from django.db import models
from django.utils import timezone from django.utils import timezone
@@ -13,7 +14,7 @@ from sortedm2m.fields import SortedManyToManyField
import string import string
from generic.models import Examination, ExamBase from generic.models import Examination, ExamBase, QuestionNote
from collections import defaultdict from collections import defaultdict
from helpers.images import image_as_base64 from helpers.images import image_as_base64
@@ -124,6 +125,8 @@ class AnatomyQuestion(models.Model):
related_name="anatomy_authored_questions", related_name="anatomy_authored_questions",
) )
notes = GenericRelation(QuestionNote)
class Meta: class Meta:
permissions = () permissions = ()
@@ -4,7 +4,7 @@
{% block content %} {% block content %}
<h2>Add Feedback</h2> <h2>Add Feedback</h2>
<div class="alert alert-info" role="alert"> <div class="alert alert-info" role="alert">
Adding feedback for {{question_type}} question [{{question.id}}] - {{question}} Adding feedback for {{question_type}}/{{question.id}} <br/> {{question}}
</div> </div>
<form action="" method="post"> <form action="" method="post">
{% csrf_token %} {% csrf_token %}
+4 -1
View File
@@ -1,3 +1,4 @@
from django.contrib.contenttypes.fields import GenericRelation
from django.db import models from django.db import models
from django.utils import timezone from django.utils import timezone
@@ -11,7 +12,7 @@ from django.utils.translation import ugettext_lazy as _
from sortedm2m.fields import SortedManyToManyField from sortedm2m.fields import SortedManyToManyField
from generic.models import ExamBase from generic.models import ExamBase, QuestionNote
import reversion import reversion
@@ -102,6 +103,8 @@ class Question(models.Model):
Category, on_delete=models.SET_NULL, null=True, blank=True Category, on_delete=models.SET_NULL, null=True, blank=True
) )
notes = GenericRelation(QuestionNote)
def __str__(self): def __str__(self):
return self.stem return self.stem