from __future__ import annotations import logging from dataclasses import dataclass from typing import TYPE_CHECKING from django.db.models.manager import BaseManager from django.template.response import TemplateResponse from core.models.twitch import Game, Owner, RewardCampaign if TYPE_CHECKING: from django.db.models.manager import BaseManager from django.http import HttpRequest, HttpResponse 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 = """