feat: changes for citation ad dynamic

This commit is contained in:
mohamad
2026-05-17 18:51:26 +03:30
parent f0a9d5832b
commit b8ab67049f
22 changed files with 1170 additions and 287 deletions
+26 -1
View File
@@ -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