From cb48e76ce2e1b78e8983a92cf5c85b5c4a953c7e Mon Sep 17 00:00:00 2001 From: lxf Date: Sun, 15 May 2022 09:28:50 -0400 Subject: page: change homepage to be static and rely on template --- app/pages/views.py | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'app/pages/views.py') diff --git a/app/pages/views.py b/app/pages/views.py index 7ea2439..4adebbf 100644 --- a/app/pages/views.py +++ b/app/pages/views.py @@ -22,19 +22,18 @@ class PageDetailTXTView(LuxDetailView): return 'pages/%s/page_detail.txt'% obj.site.name -class HomePageList(DetailView): +class HomePageView(DetailView): """ Return a main entry and list of Entries in reverse chronological order """ - model = HomePage + model = Page def get_template_names(self): - return ["pages/%s.html" % self.template_name, 'pages/homepage.html'] + return 'pages/homepage.html' - def get_context_data(self, **kwargs): + def get_queryset(self, **kwargs): # Call the base implementation first to get a context - context = super(HomePageList, self).get_context_data(**kwargs) - context['object_list'] = Post.objects.filter(post_type=PostType.HOMEPAGE).filter(status__exact=1).order_by('-pub_date')[1:9] - return context - + qs = super(HomePageView, self).get_queryset(**kwargs) + qs = Page.objects.filter(title="homepage") + return qs -- cgit v1.2.3-70-g09d2