{% extends 'base.html' %}
{% block title %}
首页
{% endblock %}
{% block head %}
<link rel="stylesheet" type="text/css" href="{{ url_for('static',filename='css/index.css') }}">
{# <p>{{ user }}context</p>#}
{% endblock %}
{% block main %}
<img width="150" height="100" class="pfs" src="https://img3.doubanio.com/lpic/s7625404.jpg" alt="">
<ul class="list-group">
{% for foo in wd %}
<li class="list-group-item">
<span class="glyphicon glyphicon-leaf" aria-hidden="true"></span>
<a href="{{ url_for('detail',question_id = foo.id)}}">{{foo.title}}</a>
<p style="">{{foo.detail}}</p>
<span class="glyphicon glyphicon-user" aria-hidden="true"></span>
<a href="{{url_for('userconter',user_id = foo.author_id)}}">{{foo.author.username}}评论:({{foo.comments length}})</a>
<span class="badge">{{foo.creat_time}}</span>
</li>
</ul>
{% endblock %}
@app.route('/')
def base():
context={
'questions': Question.query.all()
}
return render_template('home.html',**context)