diff --git a/opentech/apply/funds/models/applications.py b/opentech/apply/funds/models/applications.py index 92e2c33ae414087a9875aaf89f587b783e27d54e..62a6e13faa09dec1ff67c4a45150d162d12ea2f1 100644 --- a/opentech/apply/funds/models/applications.py +++ b/opentech/apply/funds/models/applications.py @@ -37,7 +37,6 @@ class ApplicationBaseManager(PageQuerySet): class ApplicationBase(EmailForm, WorkflowStreamForm): # type: ignore is_createable = False - template = 'funds/application_base.html' # Adds validation around forms & workflows. Isn't on Workflow class due to not displaying workflow field on Round base_form_class = WorkflowFormAdminForm @@ -53,6 +52,11 @@ class ApplicationBase(EmailForm, WorkflowStreamForm): # type: ignore parent_page_types = ['apply_home.ApplyHomePage'] + def get_template(self, request, *args, **kwargs): + # We want to force children to use our base template + # template attribute is ignored by children + return 'funds/application_base.html' + def detail(self): # The location to find out more information return self.application_public.first() diff --git a/opentech/apply/funds/tests/factories/models.py b/opentech/apply/funds/tests/factories/models.py index 144d4ef4eac47e6e961a2017f4070f7e94fb2fb5..5828a117a0f334c4abfac3fd892f8b0df610e422 100644 --- a/opentech/apply/funds/tests/factories/models.py +++ b/opentech/apply/funds/tests/factories/models.py @@ -40,6 +40,7 @@ __all__ = [ 'LabFactory', 'LabBaseFormFactory', 'LabSubmissionFactory', + 'RequestForPartnersFactory', 'SealedRoundFactory', 'SealedSubmissionFactory', 'workflow_for_stages', diff --git a/opentech/apply/funds/tests/test_models.py b/opentech/apply/funds/tests/test_models.py index 5eddda0737c153a99d474480ab8e77e29de31fa4..6e295b75792f3bb8a1fbe4bdf5ef6b37360d7089 100644 --- a/opentech/apply/funds/tests/test_models.py +++ b/opentech/apply/funds/tests/test_models.py @@ -19,6 +19,7 @@ from .factories import ( CustomFormFieldsFactory, FundTypeFactory, LabFactory, + RequestForPartnersFactory, RoundFactory, ) @@ -465,3 +466,11 @@ class TestSubmissionRenderMethods(TestCase): ) answers = submission.render_answers() self.assertNotIn(rich_text_label, answers) + + +class TestRequestForPartners(TestCase): + def test_message_when_no_round(self): + rfp = RequestForPartnersFactory() + request = make_request(site=rfp.get_site()) + response = rfp.serve(request) + self.assertContains(response, 'not accepting')