edit /allposts page so that it shows only the 3 *most recent* posts

This commit is contained in:
jieun 2017-04-04 17:41:55 -04:00
parent d8d6d2cf20
commit f8ee6f741e
1 changed files with 1 additions and 1 deletions

View File

@ -82,7 +82,7 @@ def index(page=1):
@app.route('/allposts', methods=['GET', 'POST'])
def allposts():
form = PostForm()
posts = Post.query.limit(3)
posts = Post.query.order_by(Post.timestamp.desc()).limit(3)
return render_template('allposts.html',
title='allposts',
form=form,