个人中心标签页导航

Posted 008马佳槟

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了个人中心标签页导航相关的知识,希望对你有一定的参考价值。

@app.route(/usercenter/<user_id>)

def usercenter(user_id):
    user = User.query.filter(User.id == user_id).first()
    context = {
        username_id: user.id,
        username: user.username,
        wenda: user.wenda,
        comments: user.comment

    }
    return  render_template(usercenter.html,**context)

@app.route(/userquestion/<user_id>)

def userquestion(user_id):
    user = User.query.filter(User.id == user_id).first()
    context = {
        username_id: user.id,
        username: user.username,
        wenda: user.wenda,
        comments: user.comment

    }
    return  render_template(userquestion.html,**context)

@app.route(/usercomment/<user_id>)

def usercomment(user_id):
    user = User.query.filter(User.id == user_id).first()
    context = {
        username_id: user.id,
        username: user.username,
        wenda: user.wenda,
        comments: user.comment

    }
    return  render_template(usercomment.html,**context)

if __name__ == __main__:
    app.run(debug=True)
{% extends user.html %}


{% block user %}


    <div class="container">
        <div class="row clearfix">
            <div class="col-md-2 column">
            </div>
            <div class="col-md-8 column" id="rgba1">
                <p class="text-center">
                    <small>{{ username }}</small>
                </p>
                <hr>
                <h3 align="center">
                    <small>个人信息</small>
                </h3>
                <ul class="list-group">
                    <li class="list-group-item" style="background-color: antiquewhite"><span class="glyphicon glyphicon-user"></span>用户:{{ username }}</li>
                    <li class="list-group-item" style="background-color: wheat">昵称</li>
                    <li class="list-group-item" style="background-color: aquamarine">文章篇数:{{ wenda|length }}</li>
                </ul>
            </div>
            <div class="col-md-2 column">
            </div>
        </div>
    </div>

{% endblock %}

</html>
{% extends "user.html" %}
{% block user  %}
<div class="page-header"> {% for foo in wenda %}
            <div class="panel panel-default">
                <div class="panel-heading">
                    <h3 class="panel-title">
                        <a href="{{ url_for(‘detail‘,question_id=foo.id) }}">标题:{{ foo.title }}</a><br>
                    </h3>
                    <a href="{{ url_for(‘usercenter‘,user_id=foo.author_id) }}">作者:{{ foo.author.username }}</a>
                </div>

                <div class="panel-body">
                    <a href="#">内容:{{ foo.detail }}</a><br>
                </div>
                <div class="panel-footer">
                    <span class="badge" style="margin-left: 60%">{{ foo.creat_time }}发布时间</span>
                </div>
            </div>
        {% endfor %}
        </div>
    </div>



{% endblock %}
{% extends "user.html" %}
{% block user  %}

   <div class="page-header">{% for foo in comments %}
        <li class="list-group-item">
            <a href="{{ url_for(‘usercenter‘,user_id=foo.author_id) }}">{{ foo.author.username }}</a>
            <span class="badge pull-right">{{ foo.create_time }}</span>
            <p>{{ foo.detail }}</p>
            <br>
        </li>

    {% endfor %}
    </div>

    <div class="page-header"></div>


{% endblock %}

 

以上是关于个人中心标签页导航的主要内容,如果未能解决你的问题,请参考以下文章

个人中心标签页导航

个人中心标签页导航

个人中心标签页导航

个人中心标签页导航

个人中心标签页导航

个人中心标签页导航