responsive menus
This commit is contained in:
@ -42,7 +42,7 @@ class HomeView(AttachedToMixin, BaseView, ListView):
|
||||
diffs = next_diffs[: self.related_carousel_count]
|
||||
return diffs
|
||||
|
||||
def get_last_publications(self):
|
||||
def get_publications(self):
|
||||
# note: with postgres db, possible to use distinct()
|
||||
qs = self.publications_queryset.all()
|
||||
parents = set()
|
||||
@ -56,7 +56,7 @@ class HomeView(AttachedToMixin, BaseView, ListView):
|
||||
break
|
||||
return items
|
||||
|
||||
def get_last_podcasts(self):
|
||||
def get_podcasts(self):
|
||||
return self.podcasts_queryset.all()[: self.related_carousel_count]
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
@ -69,8 +69,8 @@ class HomeView(AttachedToMixin, BaseView, ListView):
|
||||
"diffusion": current_diff,
|
||||
"logs": self.get_logs(self.object_list),
|
||||
"next_diffs": next_diffs,
|
||||
"last_publications": self.get_last_publications(),
|
||||
"last_podcasts": self.get_last_podcasts(),
|
||||
"publications": self.get_publications(),
|
||||
"podcasts": self.get_podcasts(),
|
||||
}
|
||||
)
|
||||
return super().get_context_data(**kwargs)
|
||||
|
@ -39,9 +39,15 @@ class ProgramDetailView(BaseProgramMixin, PageDetailView):
|
||||
return reverse("program-list") + f"?category__id={self.object.category_id}"
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
episodes = Episode.objects.program(self.object).published().order_by("-pub_date")[: self.related_count]
|
||||
articles = Article.objects.parent(self.object).published().order_by("-pub_date")[: self.related_count]
|
||||
return super().get_context_data(articles=articles, episodes=episodes, **kwargs)
|
||||
episodes = Episode.objects.program(self.object).published().order_by("-pub_date")
|
||||
podcasts = episodes.with_podcasts()
|
||||
articles = Article.objects.parent(self.object).published().order_by("-pub_date")
|
||||
return super().get_context_data(
|
||||
articles=articles[: self.related_count],
|
||||
episodes=episodes[: self.related_count],
|
||||
podcasts=podcasts[: self.related_count],
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
|
||||
class ProgramListView(PageListView):
|
||||
|
Reference in New Issue
Block a user