Remove ToC from blog list page

Showing an accurate ToC is complex alongside pagination
This commit is contained in:
Jake Howard 2022-10-21 16:56:40 +01:00
parent d2b9db8ace
commit db6dd80385
Signed by: jake
GPG Key ID: 57AFB45680EDD477

View File

@ -1,7 +1,6 @@
from typing import Any, Optional, Type
from django.db import models
from django.db.models.functions import TruncMonth
from django.utils import timezone
from django.utils.functional import cached_property
from modelcluster.fields import ParentalManyToManyField
@ -25,22 +24,10 @@ class BlogPostListPage(BaseListingPage):
@cached_property
def table_of_contents(self) -> list[TocEntry]:
post_months = sorted(
{
dt.strftime("%Y-%m")
for dt in self.get_paginator_page()
.object_list.annotate(
post_month=TruncMonth("date", output_field=models.DateField())
)
.values_list("post_month", flat=True)
},
reverse=True,
)
return [
TocEntry(post_month, "date-" + post_month, 0, [])
for post_month in post_months
]
"""
Showing an accurate ToC is complex alongside pagination
"""
return []
def get_listing_pages(self) -> models.QuerySet:
return (