diff --git a/lemarche/cms/models.py b/lemarche/cms/models.py index 2b3c074fc..a90fc6244 100644 --- a/lemarche/cms/models.py +++ b/lemarche/cms/models.py @@ -36,10 +36,12 @@ class ArticlePage(Page): blank=True, verbose_name="Contenu de l'article", features=settings.WAGTAIL_RICHTEXT_FIELD_FEATURES ) - def __init__(self, *args, **kwargs): - super().__init__(*args, **kwargs) + # Override template file for static pages + def get_template(self, request, *args, **kwargs): if self.is_static_page: - self.template = f"cms/static/{self.template_name}" + return f"cms/static/{self.template_name}" + else: + return super().get_template(request, *args, **kwargs) base_form_class = ArticlePageForm diff --git a/lemarche/tenders/tests.py b/lemarche/tenders/tests.py index 54eecf1bc..7b05b6d89 100644 --- a/lemarche/tenders/tests.py +++ b/lemarche/tenders/tests.py @@ -352,7 +352,7 @@ def test_with_siae_stats(self): self.assertEqual(tender_with_siae_1.siae_email_send_count_annotated, 5) self.assertEqual(tender_with_siae_1.siae_email_link_click_count_annotated, 4) self.assertEqual(tender_with_siae_1.siae_detail_display_count_annotated, 2) - self.assertEqual(tender_with_siae_1.siae_email_link_click_or_detail_display_count_annotated, 2) + self.assertEqual(tender_with_siae_1.siae_email_link_click_or_detail_display_count_annotated, 4) self.assertEqual(tender_with_siae_1.siae_detail_contact_click_count_annotated, 1) self.assertEqual(tender_with_siae_1.siae_detail_cocontracting_click_count_annotated, 1) self.assertEqual(tender_with_siae_1.siae_detail_contact_click_since_last_seen_date_count_annotated, 1)