This commit is contained in:
Ross
2025-04-07 12:09:46 +01:00
parent d387e32777
commit 7fe7823deb
4 changed files with 5 additions and 68 deletions
-3
View File
@@ -39,10 +39,7 @@ class QuestionFilter(django_filters.FilterSet):
class Meta:
model = Question
fields = {
"abnormality": ["exact"],
"region": ["exact"],
"examination": ["exact"],
"laterality": ["exact"],
# "site",
"created_date": ["exact"],
"open_access": ["exact"],
+1 -29
View File
@@ -89,36 +89,15 @@ class QuestionForm(ModelForm):
self.helper.layout = Layout(
Div(
HTML("<h4 class='clearfix' id='abnormality-label'>Abnormality</h4>"),
Field('abnormality', css_class='form-control'),
HTML("<h4 class='clear-both' id='region-label'>Region</h4>"),
Field('region', css_class='form-control'),
css_class='clearfix abnormal-fields'
),
HTML("<h4 class='clear-both' id='examination-label'>Examination*</h4>"),
Field('examination', css_class='form-control'),
Div(InlineRadios('laterality', css_class='form-control'), css_class='clearfix clear-both'),
Field('history', css_class='form-control'),
Field('marking_guidance', css_class='form-control'),
Field('feedback', css_class='form-control'),
Field('open_access', css_class='form-control'),
HTML("<h4 class='clear-both' id='exams-label'>Exams</h4>"),
Field('exams', css_class='form-control'),
)
self.fields["abnormality"] = ModelMultipleChoiceField(
required=False,
queryset=Abnormality.objects.all(),
widget=FilteredSelectMultiple(verbose_name="Abnormality", is_stacked=False),
)
self.fields["abnormality"].label = ""
self.fields["region"] = ModelMultipleChoiceField(
required=False,
queryset=Region.objects.all(),
widget=FilteredSelectMultiple(verbose_name="Region", is_stacked=False),
)
self.fields["region"].label = ""
))
self.fields["examination"] = ModelMultipleChoiceField(
queryset=Examination.objects.all(),
@@ -126,10 +105,6 @@ class QuestionForm(ModelForm):
)
self.fields["examination"].label = ""
self.fields["laterality"] = ChoiceField(
choices=Question.LATERALITY_CHOICES, required=False, widget=RadioSelect()
)
if self.user.groups.filter(name="shorts_checker").exists():
exam_queryset = Exam.objects.all()
else:
@@ -188,9 +163,6 @@ class QuestionForm(ModelForm):
# fields = ['due_back']
# fields = '__all__'
fields = [
"abnormality",
"region",
"laterality",
"examination",
# "site",
"feedback",
-28
View File
@@ -46,37 +46,9 @@ class Question(QuestionBase):
help_text="Single line history for the question, e.g. Age 14, male. Referral from ED. History: Painful wrist after falling off skateboard.",
)
NONE = "NONE"
LEFT = "LEFT"
RIGHT = "RIGHT"
BILATERAL = "BILAT"
LATERALITY_CHOICES = (
(NONE, "None"),
(LEFT, "Left"),
(RIGHT, "Right"),
(BILATERAL, "Bilateral"),
)
abnormality = models.ManyToManyField(
Abnormality,
blank=True,
help_text="The abnormality (laterality and region independent). Used for categorisation but does not affect the answer",
)
region = models.ManyToManyField(
Region,
blank=True,
help_text="Region of the abnormality (laterality independent)",
)
examination = models.ManyToManyField(
Examination, help_text="Name of the (primary) examination"
)
laterality = models.CharField(
max_length=20,
choices=LATERALITY_CHOICES,
default=NONE,
help_text="Applies to the answer, not the examination",
)
marking_guidance = models.TextField(
null=True,
+4 -8
View File
@@ -58,9 +58,7 @@
$(document).ready(function () {
$("#add_abnormality").appendTo($("#abnormality-label"));
$("#add_examination").appendTo($("#examination-label"));
$("#add_region").appendTo($("#region-label"));
dropContainer = document.getElementById("drop-container");
@@ -278,11 +276,13 @@
{% endif %}
<h2>Submit Shorts Question</h2>
<p>
<h3>Instructions</h3>
Abnormality, Region and Laterality are used to categorise within the system (they are not used for marking). Multiple images can be added to a question.
<p>
Use this form to create a new short style question/case. Multiple images can be added to a question.
If the feedback image box is checked they will not be displayed when taking the question.
</p>
<p>Once you have created the question with this form you can add relevant findings.
</p>
<!-- <div>
To monitor a directory select it here.<br />
<button id="directory-picker-button">Pick a directory</button>
@@ -290,12 +290,8 @@ If the feedback image box is checked they will not be displayed when taking the
</div> -->
<form action="" method="post" enctype="multipart/form-data" id="rapid-form">
{% comment %} {% csrf_token %} {% endcomment %}
<a href="/rapids/abnormality/create" id="add_abnormality" class="add-popup"
onclick="return showAddPopup(this);"><img src="{% static '/img/icon-addlink.svg' %}"></a>
<a href="/rapids/examination/create" id="add_examination" class="add-popup"
onclick="return showAddPopup(this);"><img src="{% static '/img/icon-addlink.svg' %}"></a>
<a href="/rapids/region/create" id="add_region" class="add-popup" onclick="return showAddPopup(this);"><img
src="{% static '/img/icon-addlink.svg' %}"></a>
{% crispy form form.helper %}