Plain is headed towards 1.0! Subscribe for development updates →

 1from typing import Any
 2
 3from .base import Card
 4
 5
 6class TableCard(Card):
 7    template_name = "admin/cards/table.html"
 8    size = Card.Sizes.FULL
 9
10    headers = []
11    rows = []
12    footers = []
13
14    def get_template_context(self) -> dict[str, Any]:
15        context = super().get_template_context()
16        context["headers"] = self.get_headers()
17        context["rows"] = self.get_rows()
18        context["footers"] = self.get_footers()
19        return context
20
21    def get_headers(self) -> list:
22        return self.headers.copy()
23
24    def get_rows(self) -> list:
25        return self.rows.copy()
26
27    def get_footers(self) -> list:
28        return self.footers.copy()