From cc6293d698de14a738b66e386ab0a33bbf4324cf Mon Sep 17 00:00:00 2001 From: Son NK <> Date: Tue, 28 Apr 2020 20:22:37 +0200 Subject: [PATCH] Order mailbox by created order --- app/dashboard/views/mailbox.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/dashboard/views/mailbox.py b/app/dashboard/views/mailbox.py index 67894f02..32d876f2 100644 --- a/app/dashboard/views/mailbox.py +++ b/app/dashboard/views/mailbox.py @@ -27,7 +27,11 @@ class NewMailboxForm(FlaskForm): @dashboard_bp.route("/mailbox", methods=["GET", "POST"]) @login_required def mailbox_route(): - mailboxes = Mailbox.query.filter_by(user_id=current_user.id).all() + mailboxes = ( + Mailbox.query.filter_by(user_id=current_user.id) + .order_by(Mailbox.created_at.desc()) + .all() + ) new_mailbox_form = NewMailboxForm()