def _render(self, *args, **kw): # Only show events that are happening "the same week" as the first one upcoming_events = EventHelper.getUpcomingEvents() template_values = { "events": upcoming_events, } path = os.path.join(os.path.dirname(__file__), '../templates/index_competitionseason.html') return template.render(path, template_values)
def _render(self, *args, **kw): special_webcasts_future = Sitevar.get_by_id_async('gameday.special_webcasts') special_webcasts_temp = special_webcasts_future.get_result() if special_webcasts_temp: special_webcasts_temp = special_webcasts_temp.contents else: special_webcasts_temp = {} special_webcasts = [] for webcast in special_webcasts_temp.values(): toAppend = {} for key, value in webcast.items(): toAppend[str(key)] = str(value) special_webcasts.append(toAppend) ongoing_events = [] ongoing_events_w_webcasts = [] upcoming_events = EventHelper.getUpcomingEvents() for event in upcoming_events: if event.within_a_day: ongoing_events.append(event) if event.webcast: valid = [] for webcast in event.webcast: if 'type' in webcast and 'channel' in webcast: event_webcast = {'event': event} valid.append(event_webcast) # Add webcast numbers if more than one for an event if len(valid) > 1: count = 1 for event in valid: event['count'] = count count += 1 ongoing_events_w_webcasts += valid template_values = {'special_webcasts': special_webcasts, 'ongoing_events': ongoing_events, 'ongoing_events_w_webcasts': ongoing_events_w_webcasts} path = os.path.join(os.path.dirname(__file__), '../templates/gameday.html') return template.render(path, template_values)