Browse Source

add collections endpoint for collection_list

weichen 4 năm trước cách đây
mục cha
commit
36beae05cb
1 tập tin đã thay đổi với 13 bổ sung0 xóa
  1. 13 0
      backstage/collections/routes.py

+ 13 - 0
backstage/collections/routes.py

@@ -0,0 +1,13 @@
+from flask import render_template, Blueprint
+import requests
+
+
+collections_app = Blueprint('collections', __name__)
+
+
+@collections_app.route('/backstage/collections')
+def collection_list():
+    collections = requests.get('http://127.0.0.1:5000/api/contents?url=/collection')
+    if collections.status_code == 200:
+        return render_template(
+            'collections.html', title='家具規劃作品', legend='家具規劃作品列表', collections=collections.json())