def find_by_author_id(cls, author_id): blogs = Database.find(collection='blogs', query={'author_id': author_id}) return [cls(**blog) for blog in blogs] # return a blog objects
def from_blog(_id): return [ post for post in Database.find(collection='posts', query={'blog_id': _id}) ]