Unignore site/ (was blocked by mkdocs /site rule), add compose/Docker/uv tooling, and split deploys so push to main goes to beta while prod stays manual.
28 lines
1.0 KiB
Python
28 lines
1.0 KiB
Python
from django.contrib.auth.decorators import login_required
|
|
from django.shortcuts import render
|
|
|
|
from contacts.models import Contact
|
|
from leads.models import Lead
|
|
from messaging.models import Campaign
|
|
from social.models import SocialPost
|
|
|
|
|
|
@login_required
|
|
def home(request):
|
|
upcoming = Campaign.objects.exclude(
|
|
status__in=[Campaign.Status.COMPLETED, Campaign.Status.CANCELLED]
|
|
).order_by("scheduled_for", "-created_at")[:5]
|
|
context = {
|
|
"lead_count": Lead.objects.filter(status=Lead.Status.NEW).count(),
|
|
"open_pipeline": Lead.objects.filter(
|
|
status__in=[Lead.Status.NEW, Lead.Status.CONTACTED]
|
|
).count(),
|
|
"contact_count": Contact.objects.count(),
|
|
"scheduled_posts": SocialPost.objects.filter(
|
|
status__in=[SocialPost.Status.SCHEDULED, SocialPost.Status.QUEUED]
|
|
).count(),
|
|
"recent_leads": Lead.objects.select_related("contact", "attribution").all()[:8],
|
|
"upcoming_campaigns": upcoming,
|
|
}
|
|
return render(request, "dashboard/home.html", context)
|