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