@app.route('/')
def shouye():
context={
'question':Question.query.all()
}
return render_template('shouye.html',**context)
{% extends'base.html' %}
{% block title %}
首页
{% endblock %}
{% block head %}
<link rel="stylesheet" href="{{ url_for('static',filename='css/shouye.css')}}" type="text/css">
{% endblock %}
{% block main %}
<body>
<div class="content">
<p class="biaoti">发布的内容</p>
<ul class="list-group">
{% for foo in question %}
<li class="list-group-item">
<span class="glyphicon-leaf" aria-hidden="true"></span>
<img id="qu" src="{{ url_for('static',filename='images/title.png')}}">
<a href = "#" onclick="window.location.replace({{url_for('detail')}})">{{ foo.title }}</a>
<p style="text-align: left">{{ foo.detail }}</p>
<img id="qu" src="{{ url_for('static',filename='images/question.jpg')}}"> <a href = "">{{ foo.author.username }}</a>
<br>
<span class="badge" style="float: right;background-color: wheat;border-radius: 5px">{{ foo.create_time }}</span>
</li>
{% endfor %}
</ul>
</div>
{% endblock %}
{% extends'base.html' %}
{% block title %}
详情页面
{% endblock %}
{% block head %}
<link rel="stylesheet" href="{{ url_for('static',filename='css/detail.css')}}" type="text/css">
{% endblock %}
{% block main %}
<body>
<div class="content">
<ul class="list-group">
{% for foo in question %}
<li class="list-group-item">
<span class="glyphicon-leaf" aria-hidden="true"></span>
<a style="font-size: 35px" href = "{{url_for('detail')}})">{{ foo.title }}</a><br>
<img id="qu" src="{{ url_for('static',filename='images/question.jpg')}}"> <a href = "">{{ foo.author.username }}</a>
<BR>
<span class="badge" style="float: right;background-color: wheat;border-radius: 5px">{{ foo.create_time }}</span>
</li>
<li class="list-group-item">
<p style="text-align: left;font-size: 24px">{{foo.detail }}</p>
</li>
{% endfor %}
<textarea class="comment" rows="8" name="title" placeholder="写下你的评论:"></textarea>
<button class="button">发布 </button>
<span class="tcomment">评论:</span>
<div class="neirong">
<span>(2)</span>
</div>
</ul>
</div>
</body>
</html>
{% endblock %}