diff --git a/anatomy/forms.py b/anatomy/forms.py index 5e3b5672..9769c492 100644 --- a/anatomy/forms.py +++ b/anatomy/forms.py @@ -25,6 +25,7 @@ from generic.models import Examination from django.contrib.admin.widgets import FilteredSelectMultiple from django.forms.widgets import RadioSelect, TextInput, Textarea +import select2.fields class AnatomyAnswerForm(ModelForm): class Meta: @@ -85,10 +86,13 @@ class AnatomyQuestionForm(ModelForm): queryset=Modality.objects.all(), ) - self.fields["structure"] = ModelChoiceField( - required=False, - queryset=Structure.objects.all(), - ) + #self.fields["structure"] = ModelChoiceField( + # required=False, + # queryset=Structure.objects.all(), + #) + self.fields["structure"] =select2.fields.ChoiceField( + choices=Structure.objects.all(), + overlay="Choose an author...") self.fields["examination"] = ModelChoiceField( required=False, diff --git a/anatomy/models.py b/anatomy/models.py index ef198e8e..2951ba2d 100644 --- a/anatomy/models.py +++ b/anatomy/models.py @@ -79,7 +79,7 @@ class AnatomyQuestion(models.Model): QuestionType, on_delete=models.SET_NULL, null=True, default=1 ) - image = models.ImageField(upload_to=image_directory_path) + 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.As a preference") image_annotations = models.TextField( blank=True, diff --git a/rad/settings.py b/rad/settings.py index 98844843..6cd8850b 100644 --- a/rad/settings.py +++ b/rad/settings.py @@ -55,6 +55,7 @@ INSTALLED_APPS = [ "dbbackup", "rest_framework", "tinymce", + "select2", ] MIDDLEWARE = [ diff --git a/rad/urls.py b/rad/urls.py index ba15eec7..7eea2e14 100644 --- a/rad/urls.py +++ b/rad/urls.py @@ -76,6 +76,9 @@ urlpatterns = [ path('api-auth/', include('rest_framework.urls')), path('tinymce/', include('tinymce.urls')), + + path('select2/', include('select2.urls')), + ] #handler400 = 'my_app.views.bad_request' diff --git a/requirements.txt b/requirements.txt index ce84e364..e66fbe8e 100644 --- a/requirements.txt +++ b/requirements.txt @@ -20,4 +20,5 @@ django-hashedfilenamestorage djangorestframework django-tinymce django-zipview -pymemcache \ No newline at end of file +pymemcache +django-select2-forms \ No newline at end of file