From acfc7852b3db05a1a9230a4901f17e5d6d6a4946 Mon Sep 17 00:00:00 2001 From: Jake Howard Date: Sun, 26 Jun 2022 17:00:44 +0100 Subject: [PATCH] Disable reading time and ToC for blog list page --- website/blog/models.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/website/blog/models.py b/website/blog/models.py index c6dd8e0..7ca03e0 100644 --- a/website/blog/models.py +++ b/website/blog/models.py @@ -3,12 +3,14 @@ from typing import Any from django.db import models from django.http.request import HttpRequest from django.utils import timezone +from django.utils.functional import cached_property from modelcluster.contrib.taggit import ClusterTaggableManager from modelcluster.fields import ParentalKey from taggit.models import ItemBase, TagBase from wagtail.admin.panels import FieldPanel from website.common.models import BaseContentMixin, BasePage +from website.common.utils import TocEntry class BlogListPage(BaseContentMixin, BasePage): # type: ignore[misc] @@ -16,6 +18,14 @@ class BlogListPage(BaseContentMixin, BasePage): # type: ignore[misc] subpage_types = ["blog.BlogPostPage"] content_panels = BasePage.content_panels + BaseContentMixin.content_panels + @cached_property + def reading_time(self) -> int: + return 0 + + @cached_property + def table_of_contents(self) -> list[TocEntry]: + return [] + def get_context(self, request: HttpRequest) -> dict: context = super().get_context(request) context["child_pages"] = (