示例#1
0
文件: views.py 项目: rjm535/5Minutes
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)
示例#2
0
文件: views.py 项目: rjm535/5Minutes
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