design
This commit is contained in:
@ -14,7 +14,7 @@ class HomeView(AttachedToMixin, BaseView, ListView):
|
||||
model = Diffusion
|
||||
queryset = Diffusion.objects.on_air().select_related("episode")
|
||||
logs_count = 5
|
||||
publications_count = 5
|
||||
publications_count = 7
|
||||
|
||||
def get_queryset(self):
|
||||
return super().get_queryset().date(date.today())
|
||||
@ -62,7 +62,7 @@ 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()[:5],
|
||||
"last_publications": self.get_last_publications(),
|
||||
}
|
||||
)
|
||||
return super().get_context_data(**kwargs)
|
||||
|
@ -123,12 +123,17 @@ class PageListView(FiltersMixin, BasePageListView):
|
||||
return qs
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
kwargs["categories"] = (
|
||||
self.model.objects.published()
|
||||
self.categories = {
|
||||
id: title
|
||||
for title, id in self.model.objects.published()
|
||||
.filter(category__isnull=False)
|
||||
.values_list("category__title", "category__id")
|
||||
.distinct()
|
||||
)
|
||||
}
|
||||
cat_id = self.request.GET.get("category__id")
|
||||
if cat_id:
|
||||
cat_id = int(cat_id)
|
||||
kwargs["category_id"] = cat_id
|
||||
return super().get_context_data(**kwargs)
|
||||
|
||||
|
||||
@ -150,6 +155,8 @@ class PageDetailView(BasePageDetailView):
|
||||
kwargs["comments"] = Comment.objects.filter(page=self.object).order_by(
|
||||
"-date"
|
||||
)
|
||||
if self.object.parent_subclass:
|
||||
kwargs["parent"] = self.object.parent_subclass
|
||||
return super().get_context_data(**kwargs)
|
||||
|
||||
@classmethod
|
||||
|
Reference in New Issue
Block a user