예제 #1
0
def unfollow(id):
    unfollow = Following.delete().where(Following.fan_id==current_user.id, Following.idol_id==id)
    user = User.get_by_id(id)
    if unfollow.execute():
        flash(f"You have unfollowed { user.user_name }", "info")
        return redirect(url_for('users.show', id=id))
    else:
        flash("Could not unfollow. Please try again.", "danger")
        return redirect(url_for('users.show', id=id))
예제 #2
0
def decline_request(id):
#   following = Following.get_or_none(Following.id == id)
    user = User.get_or_none(id=id)
    following = Following.get_or_none(Following.id == id)
    fan_name = following.fan.user_name
    following = Following.delete().where(Following.id == id)
    if following.execute():
        flash(f"You have declined {fan_name}'s request to follow you.", "info")
        return redirect(url_for('users.request', id=current_user.id, user=user, following=following))
    else:
        flash("Something went wrong. Please try again.")
        return redirect(url_for('users.request', id=current_user.id, user=user, following=following))
예제 #3
0
 def unfollow(self, idol_id):
     Following.delete().where(Following.fan_id == self.id,
                              Following.idol_id == idol_id).execute()