feat: changes for citation ad dynamic
This commit is contained in:
+26
-1
@@ -5,17 +5,42 @@ from django.shortcuts import render
|
||||
from django.views import View
|
||||
from django.views.generic import ListView, TemplateView
|
||||
|
||||
from apps.products.models import SubProduct
|
||||
|
||||
from .forms import ContactForm
|
||||
from .models import ContactSubmission, FAQEntry
|
||||
from .models import AboutSection, ContactSubmission, FAQEntry, HomepageSection
|
||||
|
||||
|
||||
class HomeView(TemplateView):
|
||||
template_name = "pages/home.html"
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
ctx = super().get_context_data(**kwargs)
|
||||
ctx["homepage_sections"] = (
|
||||
HomepageSection.objects.filter(is_active=True)
|
||||
.prefetch_related("items")
|
||||
.order_by("order")
|
||||
)
|
||||
ctx["sub_products"] = (
|
||||
SubProduct.objects.filter(is_active=True, show_on_homepage=True)
|
||||
.select_related("main_product")
|
||||
.order_by("homepage_order", "order")
|
||||
)
|
||||
return ctx
|
||||
|
||||
|
||||
class AboutView(TemplateView):
|
||||
template_name = "pages/about.html"
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
ctx = super().get_context_data(**kwargs)
|
||||
ctx["about_sections"] = (
|
||||
AboutSection.objects.filter(is_active=True)
|
||||
.prefetch_related("items")
|
||||
.order_by("order")
|
||||
)
|
||||
return ctx
|
||||
|
||||
|
||||
class FAQView(ListView):
|
||||
model = FAQEntry
|
||||
|
||||
Reference in New Issue
Block a user