This repository has been archived on 2023-09-24. You can view files and clone it, but cannot push or open issues or pull requests.
takahe/users/views/admin/stator.py
Andrew Godwin 1130c23b1e Stator stats overhaul
Removes the error table, adds a stats table and admin page.
Fixes #166
2022-12-15 12:26:44 -07:00

21 lines
584 B
Python

from django.utils.decorators import method_decorator
from django.views.generic import TemplateView
from stator.models import StatorModel, Stats
from users.decorators import admin_required
@method_decorator(admin_required, name="dispatch")
class Stator(TemplateView):
template_name = "admin/stator.html"
def get_context_data(self):
return {
"model_stats": {
model._meta.verbose_name_plural.title(): Stats.get_for_model(model)
for model in StatorModel.subclasses
},
"section": "stator",
}