<ul class="list-group"> {% for each in questions %} <li class="list-group-item" > <a class="author" href="">{{ each.author.username }}</a> <br> <a class="title" href="{{ url_for ('detail') }}">{{ each.title }}</a> <br> <span >{{ each.create_time }}</span> <p class="abstract">{{ each.detail }}</p> </li> {% endfor %} </ul>
@app.route('/') def index(): context={ 'questions': Question.query.order_by('create_time').all() } return render_template('index.html',**context)
<body id="body"> <div class="essayAera"> <ul class="list-group"> <a class="author" href="">做者名</a> <br> <a class="title" href="">標題名</a> <br> <span >建立時間</span> <p class="abstract">內容明細</p> <form action=""> <div class="form-group"> <textarea class="inputFramework" rows="6" id="details" name="detail"></textarea> </div> <button type="submit" class="btn btn-default">發送</button> </form> </ul> </div> </body>