コード例 #1
0
ファイル: views.py プロジェクト: suzukisteven/Instagram-Clone
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
ファイル: views.py プロジェクト: suzukisteven/Instagram-Clone
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
ファイル: user.py プロジェクト: arsm100/nextagram_api
 def unfollow(self, idol_id):
     Following.delete().where(Following.fan_id == self.id,
                              Following.idol_id == idol_id).execute()