diff options
author | Andrew Godwin | 2022-12-15 12:26:17 -0700 |
---|---|---|
committer | Andrew Godwin | 2022-12-15 12:26:44 -0700 |
commit | 1130c23b1e6bb1e4db71c41f5e4add903267830e (patch) | |
tree | 855b93bb481d43a6aa1f4520df8405ad1a7ea3ff /users | |
parent | 5e912ecac5aa39f2d5dbecee792665d5743a77b9 (diff) | |
download | takahe-1130c23b1e6bb1e4db71c41f5e4add903267830e.tar.gz takahe-1130c23b1e6bb1e4db71c41f5e4add903267830e.tar.bz2 takahe-1130c23b1e6bb1e4db71c41f5e4add903267830e.zip |
Stator stats overhaul
Removes the error table, adds a stats table and admin page.
Fixes #166
Diffstat (limited to 'users')
-rw-r--r-- | users/views/admin/__init__.py | 1 | ||||
-rw-r--r-- | users/views/admin/stator.py | 20 |
2 files changed, 21 insertions, 0 deletions
diff --git a/users/views/admin/__init__.py b/users/views/admin/__init__.py index b8ebc40..bb70ff7 100644 --- a/users/views/admin/__init__.py +++ b/users/views/admin/__init__.py @@ -22,6 +22,7 @@ from users.views.admin.settings import ( # noqa PoliciesSettings, TuningSettings, ) +from users.views.admin.stator import Stator # noqa @method_decorator(admin_required, name="dispatch") diff --git a/users/views/admin/stator.py b/users/views/admin/stator.py new file mode 100644 index 0000000..c3ce01d --- /dev/null +++ b/users/views/admin/stator.py @@ -0,0 +1,20 @@ +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", + } |