def announcements(): """ Loads all Announcements for today including the song of the day.""" today = datetime.now().date() all_announcements = Announcement.filter(func.date(Announcement.created_on) == today).all() song_of_the_day = get_song_of_the_day(today) return render_template('timeline.html', all_announcements=all_announcements, song_of_the_day=song_of_the_day)
def get_song_of_the_day(today=None): if not today: today = datetime.now().date() song_of_the_day = DailySong.filter(func.date(DailySong.created_on) == today).first() return song_of_the_day