shouye.html

{%  block main %}
    <img src="{{ url_for('static',filename='images/qalogo.png') }}"alt="qa">
    <p>{{ username }}contextx</p>
{% for foo in questions %} <ul class="list-group" style=""> <li class="list-group-item"> <span class="glyphicon glyphicon-leaf" aria-hidden="true"></span> <a href="#">{{ foo.author.username }}</a> <br> <a href="#">{{foo.title}}</a> <span class="badge">{{foo.create_time}}</span> <a style="">{{foo.datail}}</a> </li> {% endfor %} </ul> {% endblock %}

py

@app.route('/')
def shouye():
    context={
        'questions':question.query.all()
    }
    return render_template('shouye.html',**context)

 

xiangqing.html

{% extends 'base.html' %}
{% block title %}问答详情{% endblock %}


{% block main %}
    <div class="page-header">
    <h3>title{{ ques.title }}<br><small>author{{ ques.author_id }}{{ ques.create_time }}</small></h3>
</div>
    <p class="lead">detail{{ ques.datail }}</p>
    <hr>
    <form action="{{ url_for('question') }}" method="post" style=""></form>
{% endblock %}

py

@app.route('/xiangqing/<questions_id>')
def xiangqing(question_id):
    quest = Question.query.filter(Question.id == question_id).first()

    return render_template('xiangqing.html', ques=quest)

shouye.html

 

posted on 2017-12-01 22:56  034陈妍希  阅读(92)  评论(0编辑  收藏  举报