@@ -178,14 +178,28 @@ def series(series_slug, year=None, all=None):
178178 # Otherwise, if there are no events in requested year, return 404.
179179 abort (404 )
180180
181- events = list (reversed (series .events ))
181+ all_events = list (reversed (series .events ))
182182
183- if not all :
183+ if all :
184+ events = all_events
185+ else :
184186 if year is None :
185187 # The 'New' page displays the current year as well as the last one
186- events = [e for e in events if e .date .year >= today .year - 1 ]
188+ events = [e for e in all_events if e .date .year >= today .year - 1 ]
187189 else :
188- events = [e for e in events if e .date .year == year ]
190+ events = [e for e in all_events if e .date .year == year ]
191+
192+ # Split events between future and past
193+ # (today's event, if any, is considered future)
194+ past_events = [e for e in events if e .date < today ]
195+ future_events = [e for e in events if e .date >= today ]
196+
197+ new_history = True
198+ if not all and year is None :
199+ # On the home page of the series, if there are no recent enough
200+ # past events, show up to 5 last ones.
201+ new_history = False
202+ past_events = [e for e in all_events if e .date < today ][:5 ]
189203
190204 if all is not None :
191205 paginate_prev = {'year' : first_year }
@@ -208,11 +222,6 @@ def series(series_slug, year=None, all=None):
208222
209223 has_events = bool (events )
210224
211- # Split events between future and past
212- # (today's event, if any, is considered future)
213- past_events = [e for e in events if e .date < today ]
214- future_events = [e for e in events if e .date >= today ]
215-
216225 # Events are ordered closest first;
217226 # for future ones this means ascending order
218227 future_events .reverse ()
@@ -235,6 +244,7 @@ def series(series_slug, year=None, all=None):
235244 all_years = all_years , paginate_prev = paginate_prev ,
236245 paginate_next = paginate_next , has_events = has_events ,
237246 event_add_link = event_add_link ,
247+ new_history = new_history ,
238248 )
239249
240250
0 commit comments