37 lines
1.2 KiB
Python
37 lines
1.2 KiB
Python
import os
|
|
import platform
|
|
|
|
from django import get_version as django_version
|
|
from django.shortcuts import render, get_object_or_404
|
|
from django.utils import timezone
|
|
from .models import Project, PipelineStep, CgiAsset
|
|
|
|
|
|
def home(request):
|
|
"""Render the CGI Studio Command Center."""
|
|
projects = Project.objects.prefetch_related('steps').all()
|
|
|
|
# Simple statistics for the dashboard
|
|
total_projects = projects.count()
|
|
active_productions = projects.filter(status='PROD').count()
|
|
completed_projects = projects.filter(status='DONE').count()
|
|
|
|
context = {
|
|
"projects": projects,
|
|
"total_projects": total_projects,
|
|
"active_productions": active_productions,
|
|
"completed_projects": completed_projects,
|
|
"current_time": timezone.now(),
|
|
}
|
|
return render(request, "core/index.html", context)
|
|
|
|
def project_detail(request, slug):
|
|
"""Render the detailed pipeline for a specific production."""
|
|
project = get_object_or_404(Project.objects.prefetch_related('steps', 'assets'), slug=slug)
|
|
|
|
context = {
|
|
"project": project,
|
|
"steps": project.steps.all(),
|
|
"assets": project.assets.all(),
|
|
}
|
|
return render(request, "core/project_detail.html", context) |