From: Frédéric Péters Date: Thu, 11 Jun 2020 09:36:24 +0000 (+0200) Subject: use pages to get to topiks X-Git-Tag: v2021~159 X-Git-Url: https://git.0d.be/?p=panikweb.git;a=commitdiff_plain;h=2bc82aecd19c6d4d0370a605068cb420c22c347d use pages to get to topiks --- diff --git a/panikweb/paniktags/templatetags/paniktags.py b/panikweb/paniktags/templatetags/paniktags.py index ffd377e..2192955 100644 --- a/panikweb/paniktags/templatetags/paniktags.py +++ b/panikweb/paniktags/templatetags/paniktags.py @@ -90,7 +90,7 @@ def episode_detail(context, date=None): 'diffusions': context.get('diffusions'), 'soundfiles': soundfiles, 'date': date, - 'topiks': context.get('topiks'), + 'topik_pages': context.get('topik_pages'), } @register.inclusion_tag('emissions/detail.html', takes_context=True) @@ -332,7 +332,8 @@ def related_objects(object): @register.inclusion_tag('includes/topik.html', takes_context=True) def topik(context, topik): - return {'topik': topik} + return {'page': topik} + @register.filter def get_focus_url(object): diff --git a/panikweb/views.py b/panikweb/views.py index e42fd1d..8fe72b9 100644 --- a/panikweb/views.py +++ b/panikweb/views.py @@ -139,8 +139,10 @@ class EpisodeDetailView(EmissionEpisodeMixin, DetailView, EmissionMixin): if self.kwargs.get('emission_slug') != context['emission'].slug: raise Http404() context.update(self.get_emission_context(context['emission'])) - context['topiks'] = [x.topik for x in ItemTopik.objects.filter(episode=self.object)] + context['topik_pages'] = [x.page for x in ItemTopik.objects.filter(episode=self.object)] return context + + episode = EpisodeDetailView.as_view() @@ -531,16 +533,21 @@ class Home(TemplateView): home = Home.as_view() + class NewsItemView(DetailView): model = NewsItem + def get_context_data(self, **kwargs): context = super(NewsItemView, self).get_context_data(**kwargs) context['categories'] = NewsCategory.objects.all() context['news'] = NewsItem.objects.all().order_by('-date') - context['topiks'] = [x.topik for x in ItemTopik.objects.filter(newsitem=self.object)] + context['topik_pages'] = [x.page for x in ItemTopik.objects.filter(newsitem=self.object)] return context + + newsitemview = NewsItemView.as_view() + class News(TemplateView): template_name = 'news.html' def get_context_data(self, **kwargs): diff --git a/panikweb_templates/templates/emissions/newsitem_detail.html b/panikweb_templates/templates/emissions/newsitem_detail.html index 79dde5d..ed46904 100644 --- a/panikweb_templates/templates/emissions/newsitem_detail.html +++ b/panikweb_templates/templates/emissions/newsitem_detail.html @@ -46,7 +46,7 @@ {% block topik %} -{% for topik in topiks %} +{% for topik in topik_pages %} {% topik topik=topik %} {% endfor %} {% endblock %} diff --git a/panikweb_templates/templates/episodes/detail.html b/panikweb_templates/templates/episodes/detail.html index 1309fe2..80d8c69 100644 --- a/panikweb_templates/templates/episodes/detail.html +++ b/panikweb_templates/templates/episodes/detail.html @@ -56,7 +56,7 @@ {% endif %} {% block topik %} -{% for topik in topiks %} +{% for topik in topik_pages %} {% topik topik=topik %} {% endfor %} {% endblock %} diff --git a/panikweb_templates/templates/includes/topik.html b/panikweb_templates/templates/includes/topik.html index b59ec45..784f412 100644 --- a/panikweb_templates/templates/includes/topik.html +++ b/panikweb_templates/templates/includes/topik.html @@ -1,14 +1,14 @@ {% load thumbnail paniktags staticfiles %} - +
-
{{ topik.page.title }}
+
{{ page.title }}