Source code for help_pages.help_section

"""This module contains pydantic classes for help sections."""

import enum
from dataclasses import dataclass

from django.utils.safestring import SafeString

# TODO(AlexHx8472): Check if SafeString should be used instead or additionally for all attributes.  # noqa: FIX002

[docs] class ValueRenderType(enum.Enum): """Determines how the value part of the list is rendered."""
[docs] CODE = 'code'
[docs] PLAIN = 'plain'
@dataclass
[docs] class HelpRow: """A single row in a help section."""
[docs] key: str | SafeString
[docs] value: str | SafeString
[docs] value_render_type: ValueRenderType
[docs] hidden: bool = False
[docs] css_id: str | SafeString | None = None
@dataclass
[docs] class HelpSection: """Contains a section for the help pages."""
[docs] heading: str | SafeString
[docs] rows: list[HelpRow]
[docs] hidden: bool = False
[docs] css_id: str | SafeString | None = None
@dataclass
[docs] class HelpPage: """Contains all variable data for help pages."""
[docs] heading: str | SafeString
[docs] sections: list[HelpSection]