User profile posts were not ordered with most recent first

This commit is contained in:
jieun 2017-04-02 11:36:27 -04:00
parent dd4a0375c2
commit 7b94c6cf21
1 changed files with 2 additions and 1 deletions

View File

@ -135,7 +135,8 @@ def user(nickname, page=1):
if user is None: if user is None:
flash(gettext('User %(nickname)s not found.', nickname=nickname)) flash(gettext('User %(nickname)s not found.', nickname=nickname))
return redirect(url_for('index')) return redirect(url_for('index'))
posts = user.posts.paginate(page, POSTS_PER_PAGE, False) orderedPosts = user.posts.order_by(Post.timestamp.desc())
posts = orderedPosts.paginate(page, POSTS_PER_PAGE, False)
return render_template('user.html', return render_template('user.html',
user=user, user=user,
posts=posts) posts=posts)