def get(self, username): user = User.get_by_username(username) if not user: raise InvalidUsage(404, 'User not found') posts = user.favorites. \ order_by(Post.created_at.desc()) return posts
def get(self, username): user = User.get_by_username(username) if not user: raise InvalidUsage(404, 'User not found') posts = user.posts. \ order_by(Post.created_at.desc()). \ filter_by(owner_id=user.id) return posts
def get(self, username): user = User.get_by_username(username) if not user: raise InvalidUsage(404, 'User not found') return user