41 lines
1.2 KiB
Python
41 lines
1.2 KiB
Python
from django.views.generic import ListView, TemplateView
|
|
|
|
from .models import DownloadItem, FAQEntry
|
|
|
|
|
|
class HomeView(TemplateView):
|
|
template_name = "pages/home.html"
|
|
|
|
|
|
class AboutView(TemplateView):
|
|
template_name = "pages/about.html"
|
|
|
|
|
|
class DownloadsView(ListView):
|
|
template_name = "pages/downloads.html"
|
|
context_object_name = "download_items"
|
|
|
|
def get_queryset(self):
|
|
return DownloadItem.objects.filter(is_active=True).order_by("order", "platform")
|
|
|
|
def get_context_data(self, **kwargs):
|
|
context = super().get_context_data(**kwargs)
|
|
all_items = DownloadItem.objects.order_by("order", "platform")
|
|
context["windows_items"] = all_items.filter(
|
|
platform=DownloadItem.PLATFORM_WINDOWS
|
|
)
|
|
context["macos_items"] = all_items.filter(platform=DownloadItem.PLATFORM_MACOS)
|
|
context["linux_items"] = all_items.filter(platform=DownloadItem.PLATFORM_LINUX)
|
|
return context
|
|
|
|
|
|
class FAQView(ListView):
|
|
model = FAQEntry
|
|
template_name = "pages/faq.html"
|
|
context_object_name = "faq_entries"
|
|
queryset = FAQEntry.objects.filter(is_active=True)
|
|
|
|
|
|
class ContactView(TemplateView):
|
|
template_name = "pages/contact.html"
|