Exemplo n.º 1
0
def user_unfollow(username):
    	user = get_object_or_404(User, username=username)
    	Relationship.delete().where(
        	(Relationship.from_user == get_session_user()) &
        	(Relationship.to_user == user)
    	).execute()
    	flash('You are no longer following %s' % user.username)
    	return redirect(url_for('user_detail', username=user.username))
Exemplo n.º 2
0
def user_follow(username):
    	user = get_object_or_404(User, username=username)
    	Relationship.get_or_create(
        	from_user=get_session_user(),
        	to_user=user,
    	)
    	flash('You are now following %s' % user.username)
    	return redirect(url_for('user_detail', username=user.username))