diff options
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", + } |