def query_by_post(postid): ''' Get reply list of certain post. ''' return TabReply.select().where((TabReply.post_id == postid) & (TabReply.category != '1')).order_by( TabReply.timestamp.desc())
def query_by_post(postid): ''' Get reply list of certain post. :param postid: :return: ''' return TabReply.select().where(TabReply.post_id == postid).order_by( TabReply.timestamp.desc())
def count_of_certain(): ''' Get the count of certain kind. ''' recs = TabReply.select() return recs.count()
def query_pager(current_page_num=1): ''' Query pager ''' return TabReply.select().paginate(current_page_num, CMS_CFG['list_num'])
def total_number(): ''' Return the number. ''' # adding ``None`` to hide ``No value for argument 'database' in method call`` return TabReply.select().count(None)
def count_of_certain(): ''' Get the count of certain kind. ''' # adding ``None`` to hide ``No value for argument 'database' in method call`` return TabReply.select().count(None)
def query_all(): return TabReply.select().order_by(TabReply.timestamp.desc())
def get_by_uid(uid): recs = TabReply.select().where(TabReply.uid == uid) if recs.count(): return recs.get() return None
def count_of_comment(postid): recs = TabReply.select().join( TabPost, on=(TabReply.post_id == TabPost.uid)).where(TabPost.uid == postid) return recs.count()
def total_number(): ''' Return the number. ''' return TabReply.select().count()