23 lines
764 B
Python
23 lines
764 B
Python
from django.shortcuts import render
|
|
from django.contrib.auth.mixins import LoginRequiredMixin
|
|
from accounts import resource_action
|
|
from django.views import generic
|
|
|
|
from accounts.models import IAmPrincipal
|
|
|
|
# Create your views here.
|
|
|
|
|
|
class DashboardView(LoginRequiredMixin, generic.TemplateView):
|
|
page_name = resource_action.RESOURCE_MANAGE_DASHBOARD
|
|
template_name = "dashboard/main-dashboard.html"
|
|
|
|
def get_context_data(self, **kwargs):
|
|
context = super().get_context_data(**kwargs)
|
|
context["page_name"] = self.page_name
|
|
context["active_users"] = IAmPrincipal.objects.filter(
|
|
deleted=False, is_active=True
|
|
).count()
|
|
context["total_users"] = IAmPrincipal.objects.all().count()
|
|
return context
|