diff --git a/src/edrnsite.content/src/edrnsite/content/_dataset_metadata_form.py b/src/edrnsite.content/src/edrnsite/content/_dataset_metadata_form.py index c5fe8466..116fd9be 100644 --- a/src/edrnsite.content/src/edrnsite/content/_dataset_metadata_form.py +++ b/src/edrnsite.content/src/edrnsite/content/_dataset_metadata_form.py @@ -82,6 +82,10 @@ class DatasetMetadataForm(AbstractEDRNForm): discipline = forms.MultipleChoiceField( required=False, label='Discipline', widget=forms.CheckboxSelectMultiple, choices=discipline_choices ) + other_discipline = forms.CharField( + required=False, label='Other Discipline', max_length=60, + help_text='If choosing "Other" above ↑, please enter the name of the discipline.' + ) category = forms.ChoiceField( required=False, label='Data Category', help_text='Categorize the data.', choices=data_category_choices ) @@ -177,10 +181,8 @@ def render_email(self, form): if data['discipline']: cp.set('Dataset', 'Discipline', '|'.join(data['discipline'])) - if data['content_type']: cp.set('Dataset', 'ContentType', '|'.join(data['content_type'])) - if data['specimen_type']: cp.set('Dataset', 'SpecimenType', '|'.join(data['specimen_type'])) @@ -208,4 +210,11 @@ def render_email(self, form): buffer = StringIO() cp.write(buffer) + + if data['other_discipline']: + buffer.write('\n\n\n') + buffer.write('-' * 40) + buffer.write('\n\nThe following was entered into the "other discipline" field:\n\n') + buffer.write(data['other_discipline']) + return buffer.getvalue() diff --git a/src/edrnsite.content/src/edrnsite/content/_metadata_collection_form.py b/src/edrnsite.content/src/edrnsite/content/_metadata_collection_form.py index 1a878fc0..d9393157 100644 --- a/src/edrnsite.content/src/edrnsite/content/_metadata_collection_form.py +++ b/src/edrnsite.content/src/edrnsite/content/_metadata_collection_form.py @@ -74,6 +74,10 @@ class MetadataCollectionForm(AbstractEDRNForm): ) ) discipline = forms.MultipleChoiceField(label='Discipline', widget=forms.CheckboxSelectMultiple, choices=discipline_choices) + other_discipline = forms.CharField( + required=False, label='Other Discipline', max_length=60, + help_text='If choosing "Other" above ↑, please enter the name of the discipline.' + ) method_details = forms.CharField(label='Method Details', help_text=_method_details_help, widget=forms.Textarea) instrument = forms.CharField(label='Instrument', help_text=_instrument_help, max_length=100) category = forms.ChoiceField(label='Data Category', help_text='Categorize the data.', choices=data_category_choices) @@ -255,4 +259,10 @@ def render_email(self, form): buffer.write('\n\nThe following was entered into the "instrument" field:\n\n') buffer.write(data['instrument']) + if data['other_discipline']: + buffer.write('\n\n\n') + buffer.write('-' * 40) + buffer.write('\n\nThe following was entered into the "other discipline" field:\n\n') + buffer.write(data['other_discipline']) + return buffer.getvalue() diff --git a/src/edrnsite.content/src/edrnsite/content/base_forms.py b/src/edrnsite.content/src/edrnsite/content/base_forms.py index 17da99bb..6bc9f3bf 100644 --- a/src/edrnsite.content/src/edrnsite/content/base_forms.py +++ b/src/edrnsite.content/src/edrnsite/content/base_forms.py @@ -61,12 +61,13 @@ def discipline_choices(): '''Vocabulary for choices for disciplines.''' return [ ('genomics', 'Genomics'), + ('metabolomics', 'Metabolomics'), ('proteomics', 'Proteomics'), - ('pathology-images', 'Pathology Imagess'), + ('pathology-images', 'Pathology Images'), ('radiology', 'Radiology'), ('immunology', 'Immunology'), ('pathology', 'Pathology'), - ('undefined', 'Undefined') + ('other', 'Other'), ]