From ca8d1303d2904e6acfffdd3b050649f057d46581 Mon Sep 17 00:00:00 2001 From: MooGoo Date: Mon, 6 May 2024 00:04:06 +0800 Subject: [PATCH] admin --- app/blueprints/admin_register.py | 4 ++++ app/templates/admin/list-view.html | 21 ++++----------------- 2 files changed, 8 insertions(+), 17 deletions(-) diff --git a/app/blueprints/admin_register.py b/app/blueprints/admin_register.py index a159915..9afaeaf 100644 --- a/app/blueprints/admin_register.py +++ b/app/blueprints/admin_register.py @@ -1,3 +1,6 @@ +from sqlalchemy import ( + desc, +) from app.models.site import ( Article, ArticleCategory, @@ -64,6 +67,7 @@ 'resource_name': 'articles', 'model': Article, 'filter_by': 'organization', + 'list_query': Article.query.order_by(desc(Article.publish_date)), 'fields': { 'subject': { 'label': '標題' }, 'content': { 'label': '內容', 'type': 'textarea'}, diff --git a/app/templates/admin/list-view.html b/app/templates/admin/list-view.html index 4ae0142..5b276f9 100644 --- a/app/templates/admin/list-view.html +++ b/app/templates/admin/list-view.html @@ -8,23 +8,6 @@ -{% if register.query %} -
-
-
- - -
-
keyword: 館號、物種、採集者、採集號
-
-

Results: {{ "{:,}".format(total) }}

-
-{% endif %} - -{% if register.list_collection_filter %} -{% include "admin/inc_collection_query_buttons.html" %} -{% endif %} - {% if register.list_filter %}
@@ -35,6 +18,10 @@ {% endif %} +{% if register.list_collection_filter %} +{% include "admin/inc_collection_query_buttons.html" %} +{% endif %} +