19 lines
694 B
Python
19 lines
694 B
Python
from django.shortcuts import render
|
|
from django.db.models import Sum, Count
|
|
from .models import Firma, Fatura
|
|
|
|
def home(request):
|
|
"""Fatura Yönetimi Gösterge Paneli."""
|
|
toplam_firma = Firma.objects.count()
|
|
toplam_fatura = Fatura.objects.count()
|
|
toplam_harcama = Fatura.objects.aggregate(Sum('genel_toplam'))['genel_toplam__sum'] or 0
|
|
son_faturalar = Fatura.objects.select_related('firma').all()[:10]
|
|
|
|
context = {
|
|
"toplam_firma": toplam_firma,
|
|
"toplam_fatura": toplam_fatura,
|
|
"toplam_harcama": toplam_harcama,
|
|
"son_faturalar": son_faturalar,
|
|
"active_menu": "dashboard"
|
|
}
|
|
return render(request, "core/index.html", context) |