def follow(idol_id): idol = User.get_by_id(idol_id) if current_user.follow(idol): if current_user.follow_status(idol).is_approved: flash(f"You follow {idol.username}", "primary") else: flash(f"You send request to follow {idol.username}", "primary") return redirect(url_for('users.show', username=idol.username)) else: flash(f"Unable to follow this user, try again", "danger") return redirect(url_for('users.show', username=idol.username))
def follow(idol_id): idol = User.get_by_id(idol_id) if current_user.follow(idol): if current_user.follow_status(idol).is_approved: flash(f"You are now following {idol.username}", "info") else: flash(f"Your request to follow {idol.username} is sent", "info") return redirect(url_for('users.show', username=idol.username)) else: flash("Unable to follow this user, try again", "danger") return render_template(url_for('users.show', username=idol.username))
def follow(following_id): following = User.get_by_id(following_id) if current_user.follow(following): if current_user.follow_status(following).is_approved: flash(f"Successfully followed {following.username}!", "info") else: flash(f"Your request to follow {following.username} has been sent", "info") return redirect(url_for('users.show', username=following.username)) else: flash("Unable to follow user", "danger") return render_template( url_for('users.show', username=current_user.username))