Commit 8b8ee8b8 authored by Hervé  MENAGER's avatar Hervé MENAGER
Browse files

fix saving "cell line" information if test_type is cellular

- if test_type is "CELL", we DO need to keep the cell line name
- only create an entry in CellLine if name is not blank
parent c56d91b5
......@@ -1084,7 +1084,7 @@ class TestActivityDescriptionForm(forms.ModelForm):
def clean(self):
cleaned_data = super().clean()
if "test_type" in cleaned_data and cleaned_data["test_type"] == "CELL":
if "test_type" in cleaned_data and cleaned_data["test_type"] != "CELL":
cleaned_data["cell_line_name"] = ""
return cleaned_data
......@@ -1098,7 +1098,10 @@ class TestActivityDescriptionForm(forms.ModelForm):
"""
# right
if hasattr(self, "cleaned_data"):
if "cell_line_name" in self.cleaned_data:
if (
"cell_line_name" in self.cleaned_data
and self.cleaned_data["cell_line_name"] != ""
):
cell_line, created = models.CellLine.objects.get_or_create(
name=self.cleaned_data["cell_line_name"]
)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment