diff --git a/ippisite/ippidb/forms.py b/ippisite/ippidb/forms.py index 206bad700420c0bd8f0e275f8a938b897f1c47ed..ab1fb55f1e1535fd3dbf96b4bcbbccfe8043f6d1 100644 --- a/ippisite/ippidb/forms.py +++ b/ippisite/ippidb/forms.py @@ -716,6 +716,7 @@ class TestActivityDescriptionForm(forms.ModelForm): queryset=Protein.objects.none(), label=_("protein_domain_bound_complex_label"), help_text=_("protein_domain_bound_complex_help_text"), + required=True, ) class Meta: @@ -792,6 +793,8 @@ class TestActivityDescriptionBaseModelFormSet(BaseInlineNestedFormSet): form.nested.set_compound_names(self.__compound_names) form.nested.set_modulation_type(self.__modulation_type) form.fields["protein_complex"].queryset = Protein.objects.filter(id__in=self.__protein_subset_ids) + if Protein.objects.filter(id__in=self.__protein_subset_ids).count() == 1: + form.fields["protein_complex"].initial = Protein.objects.filter(id__in=self.__protein_subset_ids).first() def set_compound_names(self, compound_names): """