Skip to content

Commit

Permalink
add sheet template boolean field support (wip) (#1757)
Browse files Browse the repository at this point in the history
  • Loading branch information
mikkonie committed Aug 23, 2023
1 parent 529e4c4 commit 602dc7b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
1 change: 1 addition & 0 deletions config/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -786,6 +786,7 @@ def set_logging(level=None):
# HACK: Supported cubi-tk templates, excluding ones which altamISA cannot parse
SHEETS_ENABLED_TEMPLATES = [
'bulk_rnaseq',
'cancer',
'generic',
'germline',
'mass_cytometry',
Expand Down
2 changes: 1 addition & 1 deletion requirements/base.txt
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ pronto==2.5.0 # For OWL conversion

# CUBI ISA-Tab templates
cookiecutter==2.2.3
-e git+https://github.com/bihealth/cubi-isa-templates.git@71fab2ba637f9b00920b6d69d328e5ab1d1ef1e4#egg=cubi-isa-templates
-e git+https://github.com/bihealth/cubi-isa-templates.git@c4139e147fd5db10bd6478460edbbce157abe425#egg=cubi-isa-templates

# Taskflow requirements
tooz==3.0.0
Expand Down
8 changes: 4 additions & 4 deletions samplesheets/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,10 @@ def __init__(
if not all(v): # Allow empty value if in options
field_kwargs['required'] = False
self.fields[k] = forms.ChoiceField(**field_kwargs)
elif isinstance(v, bool):
field_kwargs['required'] = False
self.fields[k] = forms.BooleanField(**field_kwargs)
self.initial[k] = v
elif isinstance(v, dict):
field_kwargs['widget'] = forms.Textarea(
{'class': 'sodar-json-input'}
Expand Down Expand Up @@ -313,10 +317,6 @@ def save(self):
for k in self.json_fields:
if not isinstance(extra_context[k], dict):
extra_context[k] = json.loads(extra_context[k])
if 'is_triplet' in self.sheet_tpl.configuration:
extra_context['is_triplet'] = self.sheet_tpl.configuration[
'is_triplet'
]

with tempfile.TemporaryDirectory() as td:
cookiecutter(
Expand Down

0 comments on commit 602dc7b

Please sign in to comment.