from utils.views import LuxDetailView from django.views.generic import DetailView from posts.models import Post, PostType from .models import Page, HomePage class PageDetailView(LuxDetailView): model = Page def get_template_names(self): obj = self.get_object() return ["pages/%s.html" % (obj.slug), 'pages/page_detail.html'] class PageDetailTXTView(LuxDetailView): model = Page slug_field = "slug" def get_template_names(self): obj = self.get_object() return 'pages/%s/page_detail.txt'% obj.site.name class HomePageView(DetailView): """ Return a main entry and list of Entries in reverse chronological order """ model = Page def get_template_names(self): return 'pages/homepage.html' def get_queryset(self, **kwargs): # Call the base implementation first to get a context qs = super(HomePageView, self).get_queryset(**kwargs) qs = Page.objects.filter(title="homepage") return qs