Skip to content

Commit

Permalink
[Wagtail] Correction du chargement des pages statiques (#1035)
Browse files Browse the repository at this point in the history
* fix server error on wagtail static page edition

* fix failing old test
  • Loading branch information
SebastienReuiller authored Jan 16, 2024
1 parent 1646a33 commit 2307b59
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 5 additions & 3 deletions lemarche/cms/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion lemarche/tenders/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 2307b59

Please sign in to comment.