我们从Python开源项目中,提取了以下7个代码示例,用于说明如何使用flask.ext.login.current_user.follow()。
def follow(username): user = User.query.filter_by(username=username).first() if user is None: flash('Invalid user.') return redirect(url_for('.index')) if current_user.is_following(user): flash('You are already following this user.') return redirect(url_for('.user', username=username)) current_user.follow(user) flash('You are now following %s.' % username) return redirect(url_for('.user', username=username))
def follow(username): user = User.query.filter_by(username=username).first() if user is None: flash('?????') return redirect(url_for('main.index')) if current_user.is_following(user): flash('????????') return redirect(url_for('.user', username=username)) current_user.follow(user) flash('????? %s.' % username) return redirect(url_for('main.user', username=username)) # ????
def followed_by(username): user = User.query.filter_by(username=username).first() if user is None: flash('???????????') return redirect(url_for('main.index')) if current_user.is_following(user): flash('You are already following this user.') return redirect(url_for('.user', username=username)) current_user.follow(user) flash('You have now following %s.' % username) return redirect(url_for('main.user', username=username)) # ??????
def follow(username): user = User.query.filter_by(username = username).first() if user is None: flash('Invalid user.') return redirect(url_for('.index')) if current_user.is_following(user): flash('You are already following this user.') return redirect(url_for('.user', username = username)) current_user.follow(user) flash('You are now following %s.' % username) return redirect(url_for('.user', username = username))
def follow(username): user = User.query.filter_by(username=username).first() if user is None: flash("Invalid user.") return redirect(url_for('.index')) if current_user.is_following(user): flash('You have already following this user.') return redirect(url_for('.user', username=username)) current_user.follow(user) flash("You are now following {0}.".format(username)) return redirect(url_for('.user', username=username)) #?????????