work on lists filters + nav items

This commit is contained in:
bkfox
2020-11-08 17:54:49 +01:00
parent 774c558a36
commit 7860d9f92b
13 changed files with 126 additions and 86 deletions

View File

@ -1,6 +1,7 @@
from collections import OrderedDict
import datetime
from django.utils.translation import gettext_lazy as _
from django.views.generic import ListView
from ..models import Diffusion, Episode, Program, StaticPage, Sound
@ -29,6 +30,17 @@ class EpisodeListView(PageListView):
parent_model = Program
attach_to_value = StaticPage.ATTACH_TO_EPISODES
def get_queryset(self):
qs = super().get_queryset()
if self.filters and 'podcasts' in self.filters:
qs = qs.filter(sound__is_public=True)
return qs
def get_filters(self):
return super().get_filters() + (
(_('Podcasts'), 'podcasts', tuple()),
)
class DiffusionListView(GetDateMixin, AttachedToMixin, BaseView, ListView):
""" View for timetables """