Disable reading time and ToC for blog list page
This commit is contained in:
parent
6da155409c
commit
acfc7852b3
1 changed files with 10 additions and 0 deletions
|
@ -3,12 +3,14 @@ from typing import Any
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.http.request import HttpRequest
|
from django.http.request import HttpRequest
|
||||||
from django.utils import timezone
|
from django.utils import timezone
|
||||||
|
from django.utils.functional import cached_property
|
||||||
from modelcluster.contrib.taggit import ClusterTaggableManager
|
from modelcluster.contrib.taggit import ClusterTaggableManager
|
||||||
from modelcluster.fields import ParentalKey
|
from modelcluster.fields import ParentalKey
|
||||||
from taggit.models import ItemBase, TagBase
|
from taggit.models import ItemBase, TagBase
|
||||||
from wagtail.admin.panels import FieldPanel
|
from wagtail.admin.panels import FieldPanel
|
||||||
|
|
||||||
from website.common.models import BaseContentMixin, BasePage
|
from website.common.models import BaseContentMixin, BasePage
|
||||||
|
from website.common.utils import TocEntry
|
||||||
|
|
||||||
|
|
||||||
class BlogListPage(BaseContentMixin, BasePage): # type: ignore[misc]
|
class BlogListPage(BaseContentMixin, BasePage): # type: ignore[misc]
|
||||||
|
@ -16,6 +18,14 @@ class BlogListPage(BaseContentMixin, BasePage): # type: ignore[misc]
|
||||||
subpage_types = ["blog.BlogPostPage"]
|
subpage_types = ["blog.BlogPostPage"]
|
||||||
content_panels = BasePage.content_panels + BaseContentMixin.content_panels
|
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:
|
def get_context(self, request: HttpRequest) -> dict:
|
||||||
context = super().get_context(request)
|
context = super().get_context(request)
|
||||||
context["child_pages"] = (
|
context["child_pages"] = (
|
||||||
|
|
Loading…
Reference in a new issue