add pdocasts
This commit is contained in:
parent
d2ed8df2ac
commit
4e04cfae7e
|
@ -8,7 +8,8 @@ __all__ = ("BaseView", "BaseAPIView")
|
|||
|
||||
class BaseView(TemplateResponseMixin, ContextMixin):
|
||||
header_template_name = "aircox/widgets/header.html"
|
||||
related_count = 7
|
||||
related_count = 4
|
||||
related_carousel_count = 8
|
||||
|
||||
@property
|
||||
def station(self):
|
||||
|
|
|
@ -13,7 +13,6 @@ class HomeView(AttachedToMixin, BaseView, ListView):
|
|||
attach_to_value = StaticPage.ATTACH_TO_HOME
|
||||
model = Diffusion
|
||||
queryset = Diffusion.objects.on_air().select_related("episode").order_by("-start")
|
||||
log_diffusion_count = 3
|
||||
|
||||
publications_queryset = Page.objects.select_subclasses().published().order_by("-pub_date")
|
||||
podcasts_queryset = Episode.objects.published().with_podcasts().order_by("-pub_date")
|
||||
|
@ -25,12 +24,12 @@ class HomeView(AttachedToMixin, BaseView, ListView):
|
|||
today = date.today()
|
||||
# diffs = Diffusion.objects.on_air().date(today)
|
||||
object_list = self.object_list
|
||||
diffs = list(object_list[: self.related_count - 3])
|
||||
diffs = list(object_list[: self.related_count])
|
||||
logs = Log.objects.on_air().date(today).filter(track__isnull=False)
|
||||
if diffs:
|
||||
min_date = diffs[-1].start - timedelta(hours=1)
|
||||
logs = logs.after(min_date)
|
||||
return Log.merge_diffusions(logs, object_list, diff_count=self.log_diffusion_count)
|
||||
return Log.merge_diffusions(logs, object_list, diff_count=self.related_count)
|
||||
|
||||
def get_next_diffs(self):
|
||||
now = tz.now()
|
||||
|
@ -40,7 +39,7 @@ class HomeView(AttachedToMixin, BaseView, ListView):
|
|||
if current_diff:
|
||||
diffs = [current_diff] + list(next_diffs.exclude(pk=current_diff.pk)[:9])
|
||||
else:
|
||||
diffs = next_diffs[: self.related_count]
|
||||
diffs = next_diffs[: self.related_carousel_count]
|
||||
return diffs
|
||||
|
||||
def get_last_publications(self):
|
||||
|
@ -58,7 +57,7 @@ class HomeView(AttachedToMixin, BaseView, ListView):
|
|||
return items
|
||||
|
||||
def get_last_podcasts(self):
|
||||
return self.podcasts_queryset.all()[: self.related_count]
|
||||
return self.podcasts_queryset.all()[: self.related_carousel_count]
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
next_diffs = self.get_next_diffs()
|
||||
|
|
Loading…
Reference in New Issue
Block a user