Files
WYGIWYH/app/apps/insights/views.py
Herculino Trotta dd24fd56d3 insights (wip)
2025-02-15 00:49:00 -03:00

22 lines
552 B
Python

from django.shortcuts import render
from apps.transactions.models import Transaction
from apps.insights.utils.sankey import generate_sankey_data
def index(request):
return render(request, "insights/pages/index.html")
def sankey(request):
# Get filtered transactions
transactions = Transaction.objects.filter(date__year=2025)
# Generate Sankey data
sankey_data = generate_sankey_data(transactions)
print(sankey_data)
return render(
request, "insights/fragments/sankey.html", {"sankey_data": sankey_data}
)