From 489a212b7aafe19c95fa33d6160e3b54089f6b86 Mon Sep 17 00:00:00 2001 From: Jake Howard Date: Tue, 16 Aug 2022 20:50:34 +0100 Subject: [PATCH] Only render content once --- website/common/models.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/website/common/models.py b/website/common/models.py index 750534a..e188ef3 100644 --- a/website/common/models.py +++ b/website/common/models.py @@ -83,11 +83,15 @@ class BaseContentMixin(models.Model): @cached_property def body_html(self) -> str: - return add_heading_anchors(str(self.body)) + return add_heading_anchors(self._body_html) + + @cached_property + def _body_html(self) -> str: + return str(self.body) @cached_property def content_html(self) -> str: - return get_content_html(str(self.body)) + return get_content_html(self._body_html) @cached_property def plain_text(self) -> str: