from __future__ import annotations import logging from dataclasses import dataclass from typing import TYPE_CHECKING import requests_cache from django.db.models import Prefetch from django.db.models.manager import BaseManager from django.http import HttpRequest, HttpResponse from django.template.response import TemplateResponse from django.utils import timezone from django.views import View from core.models import Benefit, DropCampaign, Game, RewardCampaign, TimeBasedDrop, Webhook if TYPE_CHECKING: from django.db.models.manager import BaseManager from django.http import HttpRequest logger: logging.Logger = logging.getLogger(__name__) @dataclass class TOCItem: """Table of contents item.""" name: str toc_id: str def build_toc(list_of_things: list[TOCItem]) -> str: """Build the table of contents. Args: list_of_things (list[TOCItem]): The list of table of contents items. Returns: str: The HTML for the table of contents. """ html: str = """