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

  1. 首页列表显示全部问答:
    1. 将数据库查询结果传递到前端页面 Question.query.all()
    2. 前端页面循环显示整个列表。
    3. 问答排序
  2. 完成问答详情页布局:
    1. 包含问答的全部信息
    2. 评论区
    3. 以往评论列表显示区。
  3. 在首页点击问答标题,链接到相应详情页。
    @app.route('/sywdxq')
    def sywdxq():
        return  render_template('sywdxq.html')
    {% extends 'shouye.html' %}
    {% block title %}首页{% endblock %}
    {% block head %}
        <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
        <link rel="stylesheet" type="text/css" href="../static/css/sywdxq.css">
    {% endblock %}
    {% block main %}
        <div class="col-md-2 column "></div>
        <div class="col-md-8 column ">
            <div class="page-headr">
                <h1>welcome !!!</h1><br>
                <h3>Title:{{ title }}<br>
                    <small>author:{{ username }}<span class="badge">发布时间:{{creat_time }}</span></small>
                </h3>
                <hr>
                <p>detail:{{ detail }}</p>
                <hr>
                <form>
                    <div class="form-group">
                <textarea name="new_comment" class="form-control" rows="5" id="new-comment"
                          placeholder=" " style="width: 850px"></textarea><br>
                    </div>
                    <button type="submit" class="btn btn-default" style="width:100px "> 发送
                    </button>
                </form>
    {#                            <h4>comment:({{ comments|length }})</h4>#}
                <ul class="list-group" style="margin: 10px"></ul>
            </div>
        </div>
        <div class="col-md-2 column "></div>
    {% endblock %}

     

posted on 2017-12-05 16:55  104鲍珊珊  阅读(160)  评论(0编辑  收藏  举报

导航