first commit
This commit is contained in:
42
Base/Views/views.py
Normal file
42
Base/Views/views.py
Normal file
@@ -0,0 +1,42 @@
|
||||
from django.shortcuts import render
|
||||
from django.views.generic import TemplateView
|
||||
from django.contrib.auth.mixins import LoginRequiredMixin #, PermissionRequiredMixin
|
||||
from django.utils import timezone
|
||||
from django.contrib.auth import views as auth_views
|
||||
from Base.Metrics.Dashboard import (
|
||||
get_sum_of_professional,
|
||||
get_sum_of_stone,
|
||||
get_sum_of_service,
|
||||
get_sum_of_professional_detail,
|
||||
get_sum_payment_method_service,
|
||||
get_sum_of_product
|
||||
)
|
||||
from Base.Metrics.DashboardAdmin import get_total_bank,get_total_prof
|
||||
|
||||
def Home(request):
|
||||
context = { 'ok':' Tudo ok', }
|
||||
return render(request,'Home.html',context )
|
||||
|
||||
class Login(auth_views.LoginView):
|
||||
template_name = 'Login/Login.html'
|
||||
|
||||
class Dashboard(LoginRequiredMixin, TemplateView):
|
||||
template_name = 'Login/Dashboard/index.html'
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super().get_context_data(**kwargs)
|
||||
Day = timezone.localtime(timezone.now())
|
||||
context['Professional'] = get_sum_of_professional.metric(Day)
|
||||
context['Stone'] = get_sum_of_stone.metric(Day)
|
||||
context['Service'] = get_sum_of_service.metric(Day)
|
||||
context['Sum_of_professional_detail'] = get_sum_of_professional_detail.metric(Day)
|
||||
context['Sum_payment_method_service'] = get_sum_payment_method_service.metric(Day)
|
||||
context['Sum_of_product'] = get_sum_of_product.metric(Day)
|
||||
return context
|
||||
|
||||
class DashboardAdmin(LoginRequiredMixin, TemplateView):
|
||||
template_name = 'Login/DashboardAdmin/index.html'
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super().get_context_data(**kwargs)
|
||||
context['total_bank'] = get_total_bank.metric()
|
||||
context['total_prof'] = get_total_prof.metric()
|
||||
return context
|
||||
Reference in New Issue
Block a user