def get_comments(self): alist = [] for i in self.cmtids: item = Comment.get_comment_by_cmtid(i) if item.status == 1: alist.append(item) alist = sorted(alist, key=lambda cmt : cmt.like-cmt.unlike, reverse=True) return alist
def get_all_comments(self): alist = [] for i in self.cmtids: alist.append(Comment.get_comment_by_cmtid(i)) return alist