diff --git a/anatomy/forms.py b/anatomy/forms.py index 6a44b3cc..e08f3e2b 100644 --- a/anatomy/forms.py +++ b/anatomy/forms.py @@ -33,6 +33,9 @@ from dal import autocomplete from tinymce.widgets import TinyMCE +from crispy_forms.helper import FormHelper +from crispy_forms.layout import Submit + class AnatomyAnswerForm(ModelForm): class Meta: model = UserAnswer @@ -76,6 +79,14 @@ class AnatomyQuestionForm(ModelForm): ModelForm.__init__(self, *args, **kwargs) super(AnatomyQuestionForm, self).__init__(*args, **kwargs) + + self.helper = FormHelper() + self.helper.form_id = 'id-anatomy-question-form' + #self.helper.form_class = 'blueForms' + #self.helper.form_method = 'post' + #self.helper.form_action = '' + + #self.helper.add_input(Submit('submit', 'Submit')) # self.fields['question'].widget.attrs = {'class': 'question-form', 'rows': 10, 'cols': 100} # self.fields['feedback'].widget.attrs = {'class': 'feedback-form', 'rows': 10, 'cols': 100} self.fields["question_type"] = ModelChoiceField( @@ -145,15 +156,15 @@ class AnatomyQuestionForm(ModelForm): fields = [ "question_type", "image", - "answer_help", - "answer_suggest_incorrect", - "region", + "description", "modality", + "region", "structure", "feedback", "examination", "body_part", - "description", + "answer_help", + "answer_suggest_incorrect", "open_access", ] diff --git a/anatomy/models.py b/anatomy/models.py index b194cff7..e8df503c 100644 --- a/anatomy/models.py +++ b/anatomy/models.py @@ -72,12 +72,12 @@ class QuestionType(models.Model): @reversion.register class AnatomyQuestion(QuestionBase): question_type = models.ForeignKey( - QuestionType, on_delete=models.SET_NULL, null=True, default=1 + QuestionType, on_delete=models.SET_NULL, null=True, default=1, help_text="Type of question, this is the question text that will be displayed to the user." ) image = models.ImageField( upload_to=image_directory_path, - help_text="The image to use for the question. Ideally use use unmarked images and annotate (arrow) them on the test system. If you wish to reuse an image that is already uploaded 'clone' the question that contains it.", + help_text="The image to use for the question. Ideally use unmarked images and annotate (arrow) them on the test system. If you wish to reuse an image that is already uploaded 'clone' the question that contains it.", ) image_annotations = models.TextField( @@ -90,9 +90,9 @@ class AnatomyQuestion(QuestionBase): help_text="Short description of the image e.g. 'Sagittal CT Chest, Abdomen & Pelvis', will be displayed as the title.", ) - answer_help = models.TextField(default="", blank=True, null=True, help_text="Helpful information for marking") + answer_help = models.TextField(default="", blank=True, null=True, help_text="Helpful information for marking, this will not be displayed to the user taking the exam.") - answer_suggest_incorrect = ArrayField(models.CharField(max_length=255, null=True), default=list, blank=True) + answer_suggest_incorrect = ArrayField(models.CharField(max_length=255, null=True), default=list, blank=True, help_text="An array that defines text that if found in the answer is likely incorrect. This is used to aid marking") examination = models.ForeignKey( Examination, on_delete=models.SET_NULL, null=True, blank=True diff --git a/anatomy/templates/anatomy/anatomyquestion_form.html b/anatomy/templates/anatomy/anatomyquestion_form.html index 0cea5e31..46436df7 100644 --- a/anatomy/templates/anatomy/anatomyquestion_form.html +++ b/anatomy/templates/anatomy/anatomyquestion_form.html @@ -1,6 +1,12 @@ {% extends "anatomy/base.html" %} {% load static %} +{% load crispy_forms_tags %} + +{% block title %} + Anatomy +{% endblock %} + {% block js %} @@ -220,6 +226,12 @@ {% endif %}
This form can be used to create an Anatomy question.
+ +Question type can be selected from a predefined list. If you require a more please contact ross.kruger@nhs.net.
+