diff --git a/hypha/apply/funds/tests/test_admin_form.py b/hypha/apply/funds/tests/test_admin_form.py index 5d1ec92bcbc05c49fe1a0936f96b9aedfc3792bd..13d126881b4e6c9bf856ab2ad5520fcaeb3c8eaf 100644 --- a/hypha/apply/funds/tests/test_admin_form.py +++ b/hypha/apply/funds/tests/test_admin_form.py @@ -38,14 +38,16 @@ def formset_base(field, total, delete, factory, same=False, form_stage_info=None return base_data -def form_data(num_appl_forms=0, num_review_forms=0, num_determination_forms=0, delete=0, stages=1, same_forms=False, form_stage_info=[1]): +def form_data(num_appl_forms=0, num_review_forms=0, num_determination_forms=0, num_external_review_forms=0, delete=0, stages=1, same_forms=False, form_stage_info=[1]): form_data = formset_base( 'forms', num_appl_forms, delete, same=same_forms, factory=ApplicationFormFactory, form_stage_info=form_stage_info) review_form_data = formset_base('review_forms', num_review_forms, False, same=same_forms, factory=ReviewFormFactory) + external_review_form_data = formset_base('external_review_forms', num_external_review_forms, True, same=same_forms, factory=ReviewFormFactory) determination_form_data = formset_base('determination_forms', num_determination_forms, False, same=same_forms, factory=DeterminationFormFactory) form_data.update(review_form_data) + form_data.update(external_review_form_data) form_data.update(determination_form_data) fund_data = factory.build(dict, FACTORY_CLASS=FundTypeFactory) diff --git a/hypha/apply/funds/tests/test_admin_views.py b/hypha/apply/funds/tests/test_admin_views.py index 56d33862bbf7e64d8fb1af32b5bffebb374c082c..ae18d2d49f71215657a12d76b8bd027a6e400a4b 100644 --- a/hypha/apply/funds/tests/test_admin_views.py +++ b/hypha/apply/funds/tests/test_admin_views.py @@ -35,7 +35,7 @@ class TestFundCreationView(TestCase): cls.user = SuperUserFactory() cls.home = ApplyHomePageFactory() - def create_page(self, appl_forms=1, review_forms=1, determination_forms=1, stages=1, same_forms=False, form_stage_info=[1]): + def create_page(self, appl_forms=1, review_forms=1, determination_forms=1, external_review_form=0, stages=1, same_forms=False, form_stage_info=[1]): self.client.force_login(self.user) url = reverse('wagtailadmin_pages:add', args=('funds', 'fundtype', self.home.id)) @@ -43,6 +43,7 @@ class TestFundCreationView(TestCase): appl_forms, review_forms, determination_forms, + external_review_form, same_forms=same_forms, stages=stages, form_stage_info=form_stage_info, diff --git a/hypha/apply/review/views.py b/hypha/apply/review/views.py index a66780b060d5d742a76f0f532f6748d0e2f894fb..1e1ab63cf40ae1606c36159ae8f6f20b7d781945 100644 --- a/hypha/apply/review/views.py +++ b/hypha/apply/review/views.py @@ -53,13 +53,13 @@ class ReviewContextMixin: def get_fields_for_stage(submission, user=None): forms = submission.get_from_parent('review_forms').all() - external_review_forms = submission.get_from_parent('external_review_forms') + external_review_forms = submission.get_from_parent('external_review_forms').all() # Use ExternalReviewForm if submission's stage has external review and external review form is attached to fund. # ExternalReviewForm is only for non-staff reviewers(external reviewers) if submission.stage.has_external_review and external_review_forms: if user and not user.is_apply_staff: - forms = external_review_forms.all() + forms = external_review_forms index = submission.workflow.stages.index(submission.stage) try: