edit /allposts page so that it shows only the 3 *most recent* posts
This commit is contained in:
		
							parent
							
								
									d8d6d2cf20
								
							
						
					
					
						commit
						f8ee6f741e
					
				|  | @ -82,7 +82,7 @@ def index(page=1): | ||||||
| @app.route('/allposts', methods=['GET', 'POST']) | @app.route('/allposts', methods=['GET', 'POST']) | ||||||
| def allposts(): | def allposts(): | ||||||
|     form = PostForm() |     form = PostForm() | ||||||
|     posts = Post.query.limit(3) |     posts = Post.query.order_by(Post.timestamp.desc()).limit(3) | ||||||
|     return render_template('allposts.html', |     return render_template('allposts.html', | ||||||
|                            title='allposts', |                            title='allposts', | ||||||
|                            form=form, |                            form=form, | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue