def index(): return { 'function': 'displayMain', 'content': { 'template': render_template( "index.haml", podcasts=Podcast.list(number=5), blog_posts = BlogPost.list(number=3), events = Event.query\ .filter(cast(Event.begin, Date) >= date.today())\ .order_by(Event.begin.asc())\ .limit(5).all() ) } }
def blogs(): page = request.args.get('page', 1, type=int) pagination = BlogPost.query \ .order_by(BlogPost.timestamp.desc()) \ .paginate(page, per_page=10, error_out=False) blog_posts = pagination.items return { 'function': 'displayMain', 'content': { 'template': render_template("main_pages/blogs.haml", blog_posts=BlogPost.list(number=10), pagination=pagination), 'title': "Blogs", 'description': "Les articles de blog de Radio Rhino" } }