From d453c839742c47f2f67d83de485c445de3366bcc Mon Sep 17 00:00:00 2001 From: Son NK <> Date: Tue, 28 Apr 2020 20:08:45 +0200 Subject: [PATCH] order api key by created order --- app/dashboard/views/api_key.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/dashboard/views/api_key.py b/app/dashboard/views/api_key.py index bd946a14..e1628b9d 100644 --- a/app/dashboard/views/api_key.py +++ b/app/dashboard/views/api_key.py @@ -15,7 +15,11 @@ class NewApiKeyForm(FlaskForm): @dashboard_bp.route("/api_key", methods=["GET", "POST"]) @login_required def api_key(): - api_keys = ApiKey.query.filter(ApiKey.user_id == current_user.id).all() + api_keys = ( + ApiKey.query.filter(ApiKey.user_id == current_user.id) + .order_by(ApiKey.created_at.desc()) + .all() + ) new_api_key_form = NewApiKeyForm()