示例#1
0
def show_user_followed_users():
    userid          = request.args.get("userid",None)
    user            = User.get_user_by_id(userid)
    followed_users  = Follow.get_followed_users_by_user(user)

    return render_template("show_followed_users.html",
                           followed_users=followed_users,
                           theuser=user)
示例#2
0
def personal_center(userid=None):
    theuser = None
    if userid is None:
        theuser = session['user']
    else:
        theuser = User.get_user_by_id(userid)

    page        = request.args.get("page", 1, type=int)
    tweets      = Tweet.get_users_tweets(theuser,offset=page-1,limit=15)

    return render_template("personal_center.html",
                            theuser=theuser,
                            tweets=tweets,
                            more_url = url_for("personal_center",page=page+1,userid=userid)
                            )
示例#3
0
 def test_get_user_by_id(self):
     user = User.get_user_by_id(self.user.id)
     eq_(user,self.user)
示例#4
0
def toggle_follow():
    followeduserid = request.form['followeduserid']
    Follow.toggle_follow(session['user'], User.get_user_by_id(followeduserid))
    return jsonify(result="done")