Skip to content

Commit

Permalink
Support for #369
Browse files Browse the repository at this point in the history
  • Loading branch information
nutjob4life committed Sep 11, 2024
1 parent 61005b4 commit 7a84f47
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
Expand Down Expand Up @@ -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']))

Expand Down Expand Up @@ -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()
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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()
5 changes: 3 additions & 2 deletions src/edrnsite.content/src/edrnsite/content/base_forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
]


Expand Down

0 comments on commit 7a84f47

Please sign in to comment.