def get_post(cls, id): post_data = Database.find_one(collection='posts', query={'_id': id}) post = cls(**post_data) post.created_date = str(post.created_date.ctime()) return post
def get_comment(cls, id): comment_data = Database.find_one(collection='comments', query={'_id': id}) comment = cls(**comment_data) comment.created_date = str(comment.created_date.ctime()) return comment
def get_by_email(cls, email): data = Datebase.find_one(collection='admins', query={'email': email}) if data is not None: return cls(**data)