def unfollow_user(username): user = User.query.filter_by(username=username).first() if not user: raise InvalidUsage.user_not_found() current_identity.profile.unfollow(user.profile) current_identity.profile.save() return user.profile
def login_user(email, password, **kwargs): user = User.query.filter_by(email=email).first() if user is not None and user.check_password(password): return user else: raise InvalidUsage.user_not_found()
def get_profile(username): user = User.query.filter_by(username=username).first() if not user: raise InvalidUsage.user_not_found() return user.profile