Phase 2: T-201 至 T-206 前台 MVP 全部实现(11 templates + CSS + 31 tests)

This commit is contained in:
ila
2026-07-06 22:57:08 +08:00
parent 5604e2cde5
commit cff3c64c19
20 changed files with 996 additions and 98 deletions
+18 -1
View File
@@ -2,6 +2,23 @@ from django.db import models
from wagtail.models import Page
from core.models import ScenarioPage, SkeletonProjectPage, ArticlePage
class HomePage(Page):
pass
parent_page_types = ["wagtailcore.Page"]
max_count = 1
def get_context(self, request, *args, **kwargs):
context = super().get_context(request, *args, **kwargs)
context["scenarios"] = ScenarioPage.objects.live()
context["featured_projects"] = (
SkeletonProjectPage.objects.live().filter(is_featured=True)
.prefetch_related("scenarios", "languages")
.order_by("-first_published_at")[:6]
)
context["latest_articles"] = (
ArticlePage.objects.live()
.order_by("-first_published_at")[:4]
)
return context