diff --git a/hypha/apply/determinations/models.py b/hypha/apply/determinations/models.py index 1fb2355076d629f19db608e704c7191a86bf781c..0e2dfe9668e5bd47205c3dc1ed35d5dce9e85a24 100644 --- a/hypha/apply/determinations/models.py +++ b/hypha/apply/determinations/models.py @@ -142,7 +142,9 @@ class Determination(DeterminationFormFieldsMixin, AccessFormData, models.Model): group = 0 data.setdefault(group, {'title': None, 'questions': list()}) for field in self.form_fields: - if issubclass(field.block.__class__, DeterminationMustIncludeFieldBlock): + if issubclass( + field.block.__class__, DeterminationMustIncludeFieldBlock + ) or isinstance(field.block, SendNoticeBlock): continue try: value = self.form_data[field.id] diff --git a/hypha/apply/determinations/views.py b/hypha/apply/determinations/views.py index 824df2f7616b52334c8fbfd8c18740129c3d16c3..15029846aded56072e70137ed1b340c4976fe303 100644 --- a/hypha/apply/determinations/views.py +++ b/hypha/apply/determinations/views.py @@ -140,8 +140,21 @@ class BatchDeterminationCreateView(BaseStreamForm, CreateView): kwargs.pop('instance') return kwargs + def check_all_submissions_are_of_same_type(self, submissions): + return len(set( + [ + submission.is_determination_form_attached + for submission in submissions + ] + )) == 1 + def get_form_class(self): submissions = self.get_submissions() + if not self.check_all_submissions_are_of_same_type(submissions): + raise ValueError( + "All selected submissions excpects determination forms attached" + " - please contact admin" + ) if not submissions[0].is_determination_form_attached: return get_form_for_stages(submissions) form_fields = self.get_form_fields() diff --git a/hypha/apply/review/forms.py b/hypha/apply/review/forms.py index 1e7dc2db35b81c5e358dbb822c0fdde40afd7cc4..76b6368188692044bdc35f0628aed6ff7fb7c026 100644 --- a/hypha/apply/review/forms.py +++ b/hypha/apply/review/forms.py @@ -42,6 +42,7 @@ class ReviewModelForm(StreamBaseForm, forms.ModelForm, metaclass=MixedMetaClass) initial[key] = value super().__init__(*args, initial=initial, instance=instance, **kwargs) + for field in self._meta.widgets: self.fields[field].disabled = True