feat: rebuild site content management
Replace legacy FAQ, downloads, and release flows with project and blog publishing. Add configurable branding and theme fields plus clean-start Compose seeding support.
This commit is contained in:
+27
-31
@@ -4,6 +4,7 @@ from django.db.models import Prefetch
|
||||
from django.http import Http404, JsonResponse
|
||||
from django.shortcuts import render
|
||||
from django.urls import reverse
|
||||
from django.utils import timezone
|
||||
from django.views import View
|
||||
from django.views.generic import DetailView, ListView, TemplateView
|
||||
|
||||
@@ -12,10 +13,10 @@ from apps.products.models import MainProduct, SubProduct
|
||||
from .forms import ContactForm
|
||||
from .models import (
|
||||
AboutSection,
|
||||
BlogPost,
|
||||
ContactSubmission,
|
||||
ContactSubmissionAttachment,
|
||||
CustomPage,
|
||||
FAQEntry,
|
||||
HeroSection,
|
||||
HomepageSection,
|
||||
PageVideo,
|
||||
@@ -79,31 +80,6 @@ class AboutView(TemplateView):
|
||||
return ctx
|
||||
|
||||
|
||||
class FAQView(ListView):
|
||||
model = FAQEntry
|
||||
template_name = "pages/faq.html"
|
||||
context_object_name = "faq_entries"
|
||||
queryset = FAQEntry.objects.filter(is_active=True)
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
ctx = super().get_context_data(**kwargs)
|
||||
videos = PageVideo.objects.filter(
|
||||
page=PageVideo.PAGE_FAQ,
|
||||
is_active=True,
|
||||
).order_by("order", "pk")
|
||||
preview = _video_preview_context(
|
||||
videos,
|
||||
reverse(
|
||||
"pages:video_archive",
|
||||
kwargs={"library": PageVideo.PAGE_FAQ},
|
||||
),
|
||||
)
|
||||
ctx["faq_videos"] = preview["videos"]
|
||||
ctx["videos_total_count"] = preview["videos_total_count"]
|
||||
ctx["videos_archive_url"] = preview["videos_archive_url"]
|
||||
return ctx
|
||||
|
||||
|
||||
class ContactView(View):
|
||||
template_name = "pages/contact.html"
|
||||
|
||||
@@ -198,6 +174,31 @@ class CustomPageView(DetailView):
|
||||
return ctx
|
||||
|
||||
|
||||
class BlogPostListView(ListView):
|
||||
model = BlogPost
|
||||
template_name = "pages/blog_list.html"
|
||||
context_object_name = "posts"
|
||||
paginate_by = 9
|
||||
|
||||
def get_queryset(self):
|
||||
return BlogPost.objects.filter(
|
||||
status=BlogPost.STATUS_PUBLISHED,
|
||||
published_at__lte=timezone.now(),
|
||||
)
|
||||
|
||||
|
||||
class BlogPostDetailView(DetailView):
|
||||
model = BlogPost
|
||||
template_name = "pages/blog_detail.html"
|
||||
context_object_name = "post"
|
||||
|
||||
def get_queryset(self):
|
||||
return BlogPost.objects.filter(
|
||||
status=BlogPost.STATUS_PUBLISHED,
|
||||
published_at__lte=timezone.now(),
|
||||
)
|
||||
|
||||
|
||||
class PageVideoArchiveView(ListView):
|
||||
model = PageVideo
|
||||
template_name = "videos/archive.html"
|
||||
@@ -210,11 +211,6 @@ class PageVideoArchiveView(ListView):
|
||||
"Guides and updates from the Communication to Care team.",
|
||||
"pages:contact",
|
||||
),
|
||||
PageVideo.PAGE_FAQ: (
|
||||
"FAQ videos",
|
||||
"Video answers to common questions.",
|
||||
"pages:faq",
|
||||
),
|
||||
}
|
||||
|
||||
def get_page_config(self):
|
||||
|
||||
Reference in New Issue
Block a user