home page fixes; various issues fix
This commit is contained in:
@ -18,18 +18,21 @@ class HomeView(AttachedToMixin, BaseView, ListView):
|
||||
podcasts_queryset = Episode.objects.published().with_podcasts().order_by("-pub_date")
|
||||
|
||||
def get_queryset(self):
|
||||
return super().get_queryset().before(datetime.now() - timedelta(hours=12))
|
||||
now = datetime.now()
|
||||
return super().get_queryset().after(now - timedelta(hours=24)).before(now).order_by("-start")
|
||||
|
||||
def get_logs(self, diffusions):
|
||||
today = date.today()
|
||||
# diffs = Diffusion.objects.on_air().date(today)
|
||||
object_list = self.object_list
|
||||
diffs = list(object_list[: self.related_count])
|
||||
logs = Log.objects.on_air().date(today).filter(track__isnull=False)
|
||||
logs = Log.objects.on_air().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.related_count, log_slice=10)
|
||||
else:
|
||||
logs = logs.date(today)
|
||||
return Log.merge_diffusions(logs, object_list, diff_count=self.related_count)
|
||||
|
||||
def get_next_diffs(self):
|
||||
now = tz.now()
|
||||
|
Reference in New Issue
Block a user