From a9e6b7e17fc7fccb4a94e17a531aba47041edd99 Mon Sep 17 00:00:00 2001 From: bkfox Date: Fri, 22 May 2020 14:46:03 +0200 Subject: [PATCH] show pub date --- aircox/templates/aircox/page_detail.html | 7 ++++++- aircox/views/episode.py | 2 +- aircox/views/log.py | 3 ++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/aircox/templates/aircox/page_detail.html b/aircox/templates/aircox/page_detail.html index ad884f1..26b4138 100644 --- a/aircox/templates/aircox/page_detail.html +++ b/aircox/templates/aircox/page_detail.html @@ -10,7 +10,12 @@ Context: {% if page.category %} {% block header_meta %}{{ block.super }} -{{ object.category.title }} + + {% if object.category %} + {{ object.category.title }} // + {% endif %} + {{ object.pub_date }} + {% endblock %} {% endif %} diff --git a/aircox/views/episode.py b/aircox/views/episode.py index d20d5e0..f5a6f7d 100644 --- a/aircox/views/episode.py +++ b/aircox/views/episode.py @@ -46,7 +46,7 @@ class DiffusionListView(GetDateMixin, BaseView, ListView): return date if date is not None else datetime.date.today() def get_queryset(self): - return super().get_queryset().today(self.date).order_by('start') + return super().get_queryset().date(self.date).order_by('start') def get_context_data(self, **kwargs): start = self.date - datetime.timedelta(days=self.date.weekday()) diff --git a/aircox/views/log.py b/aircox/views/log.py index 855c1b7..b217aa9 100644 --- a/aircox/views/log.py +++ b/aircox/views/log.py @@ -66,8 +66,9 @@ class LogListView(BaseView, LogListMixin, ListView): def get_context_data(self, **kwargs): today = datetime.date.today() + # `super()...` must be called before updating kwargs, in order + # to get `self.object_list` kwargs = super().get_context_data(**kwargs) - print('objects:', self.date, self.get_queryset(), kwargs['object_list']) kwargs.update({ 'date': self.date, 'dates': (today - datetime.timedelta(days=i) for i in range(0, 7)),