Files
goodtimes/dashboard/views.py

23 lines
764 B
Python
Raw Permalink Normal View History

2024-02-29 13:25:50 +05:30
from django.shortcuts import render
from django.contrib.auth.mixins import LoginRequiredMixin
from accounts import resource_action
from django.views import generic
2024-03-26 11:05:46 +05:30
from accounts.models import IAmPrincipal
2024-02-29 13:25:50 +05:30
# 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
2024-03-26 11:05:46 +05:30
context["active_users"] = IAmPrincipal.objects.filter(
deleted=False, is_active=True
).count()
context["total_users"] = IAmPrincipal.objects.all().count()
2024-02-29 13:25:50 +05:30
return context