forked from rc/aircox
work on website + page becomes concrete
This commit is contained in:
@ -1,16 +1,36 @@
|
||||
from ..models import Article
|
||||
from .program import ProgramPageListView
|
||||
from ..models import Article, Program
|
||||
from .page import ParentMixin, PageDetailView, PageListView
|
||||
|
||||
|
||||
__all__ = ['ArticleListView']
|
||||
__all__ = ['ArticleDetailView', 'ArticleListView']
|
||||
|
||||
|
||||
class ArticleListView(ProgramPageListView):
|
||||
class ArticleDetailView(PageDetailView):
|
||||
show_side_nav = True
|
||||
model = Article
|
||||
|
||||
def get_side_queryset(self):
|
||||
qs = Article.objects.select_related('cover') \
|
||||
.filter(is_static=False) \
|
||||
.order_by('-date')
|
||||
return qs
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
if self.object.program is not None:
|
||||
kwargs.setdefault('parent', self.object.program)
|
||||
return super().get_context_data(**kwargs)
|
||||
|
||||
|
||||
class ArticleListView(ParentMixin, PageListView):
|
||||
model = Article
|
||||
template_name = 'aircox/article_list.html'
|
||||
show_headline = True
|
||||
is_static = False
|
||||
|
||||
def get_queryset(self):
|
||||
return super().get_queryset(is_static=self.is_static)
|
||||
parent_model = Program
|
||||
fk_parent = 'program'
|
||||
|
||||
def get_queryset(self):
|
||||
return super().get_queryset().filter(is_static=self.is_static)
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user