This repository has been archived on 2024-05-31. You can view files and clone it, but cannot push or open issues or pull requests.
authentik/passbook/admin/views/overview.py

23 lines
942 B
Python
Raw Normal View History

"""passbook administration overview"""
2018-11-11 12:41:48 +00:00
from django.views.generic import TemplateView
2018-11-16 08:10:35 +00:00
from passbook.admin.mixins import AdminRequiredMixin
2019-02-21 15:06:57 +00:00
from passbook.core.models import (Application, Factor, Invitation, Policy,
Provider, Source, User)
2018-11-11 12:41:48 +00:00
2018-11-16 08:10:35 +00:00
class AdministrationOverviewView(AdminRequiredMixin, TemplateView):
"""Overview View"""
2018-11-11 12:41:48 +00:00
template_name = 'administration/overview.html'
def get_context_data(self, **kwargs):
kwargs['application_count'] = len(Application.objects.all())
2019-02-16 09:24:31 +00:00
kwargs['policy_count'] = len(Policy.objects.all())
2018-11-11 12:41:48 +00:00
kwargs['user_count'] = len(User.objects.all())
2018-11-16 10:40:24 +00:00
kwargs['provider_count'] = len(Provider.objects.all())
2019-02-21 15:06:57 +00:00
kwargs['source_count'] = len(Source.objects.all())
kwargs['factor_count'] = len(Factor.objects.all())
kwargs['invitation_count'] = len(Invitation.objects.all())
2018-11-11 12:41:48 +00:00
return super().get_context_data(**kwargs)