routes.py 725 B

123456789101112131415161718
  1. from flask import render_template, Blueprint
  2. import requests
  3. from backstage.collections.forms import CollectionCreateForm
  4. collections_app = Blueprint('collections', __name__)
  5. @collections_app.route('/backstage/collections')
  6. def collection_list():
  7. response = requests.get('http://127.0.0.1:5000/api/contents?url=/collection')
  8. if response.status_code == 200:
  9. return render_template('collections.html',
  10. title='家具規劃作品',
  11. legend='家具規劃作品列表',
  12. collections=response.json(),
  13. length=len(response.json()),
  14. form=CollectionCreateForm())