Beispiel #1
0
 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())
Beispiel #2
0
 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())
Beispiel #3
0
    def count_of_certain():
        '''
        Get the count of certain kind.
        '''

        recs = TabReply.select()

        return recs.count()
Beispiel #4
0
 def query_pager(current_page_num=1):
     '''
     Query pager
     '''
     return TabReply.select().paginate(current_page_num,
                                       CMS_CFG['list_num'])
Beispiel #5
0
 def total_number():
     '''
     Return the number.
     '''
     # adding ``None`` to hide ``No value for argument 'database' in method call``
     return TabReply.select().count(None)
Beispiel #6
0
 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)
Beispiel #7
0
 def query_all():
     return TabReply.select().order_by(TabReply.timestamp.desc())
Beispiel #8
0
 def get_by_uid(uid):
     recs = TabReply.select().where(TabReply.uid == uid)
     if recs.count():
         return recs.get()
     return None
Beispiel #9
0
 def count_of_comment(postid):
     recs = TabReply.select().join(
         TabPost,
         on=(TabReply.post_id == TabPost.uid)).where(TabPost.uid == postid)
     return recs.count()
Beispiel #10
0
 def total_number():
     '''
     Return the number.
     '''
     return TabReply.select().count()