首页列表显示全部问答,完成问答详情页布局

@app.route('/')
def index():
    context = {
        'questions':Question.query.order_by('-creat_time').all()
    }
    return render_template('index首页.html',**context)



@app.route('/detail/<question_id>')
def detail(question_id):

    return render_template('detail.html',ques = question_id)



{% extends 'base父模板.html' %}
{% block title %}问答{% endblock %}
<meta charset="UTF-8">

{% block main %}

    <div class="page-header">
        <h3>Title {{ ques }}<br>
            <small>author r</small>
        </h3>
    </div>
    <p class="lead">detail</p>
    <hr>

    <form action="{{ url_for('question') }}" method="post" style="align-content: center">
        <div class="form-group">
            <textarea name="new_comment" id="new_comment" cols="30" rows="3" class="form-control"
                      placeholder="请输入内容"></textarea>
        </div>
        <button type="submit" class="btn btn-default">发送</button>
    </form>
    <ul class="list-group" style="margin: 10px"></ul>
{% endblock %}

 

posted @ 2017-12-02 14:34  007王俊祺  阅读(153)  评论(0编辑  收藏  举报