标签:lock contex html span user column name type for
{% block body %} <div class="container"> <div class="row clearfix"> <div class="col-md-2 column"> </div> <div class="col-md-8 column"> {% for foo in questions %} <div class="list-group"> <a href="#" class="list-group-item active">作者:{{ foo.author_id }}</a> <div class="list-group-item"> <h4 class="list-group-item-heading"> {{ foo.title }} </h4> <p class="list-group-item-text"> {{ foo.detail }} </p> </div> <div class="list-group-item"> <span class="badge">发布时间:{{ foo.create_time }}</span> 发布时间 </div> </div> {% endfor %} <div class="col-md-2 column"> </div> </div> </div> {% endblock %}
1 python文件 2 @app.route(‘/‘) 3 def lx(): 4 context = { 5 ‘questions‘: Ques.query.all() 6 } 7 return render_template(‘lx3.html‘, **context)
1 @app.route(‘/detail/<question_id>‘) 2 def detail(question_id): 3 quest = Ques.query.filter(Ques.id==question_id).first() 4 return render_template(‘detail.html‘,quest=quest)
1 {% block detailbody %} 2 <div class="container"> 3 <div class="row clearfix"> 4 <div class="col-md-3 column"> 5 </div> 6 <div class="col-md-6 column"> 7 <div class="row clearfix"> 8 <div class="col-md-12 column"> 9 <h3> 10 {{ quest.title }} 11 </h3> <span class="label label-default">{{ quest.author.username }}</span> <span 12 class="label label-default">{{ quest.author.create_time }}</span> 13 </div> 14 </div> 15 <div class="row clearfix"> 16 <div class="col-md-12 column"> 17 <p> 18 {{ quest.detail }} 19 </p> 20 </div> 21 </div> 22 <div class="row clearfix"> 23 <div class="col-md-12 column"> 24 <textarea id="comment" name="comment" rows="8" placeholder="请输入评论"></textarea> 25 </div> 26 </div> 27 <button type="button" class="btn btn-default btn-block">发送</button> 28 </div> 29 <div class="col-md-3 column"> 30 </div> 31 </div> 32 </div> 33 {% endblock %} 34 复制代码
标签:lock contex html span user column name type for
原文地址:http://www.cnblogs.com/coffee2/p/7955642.html