Ejemplo n.º 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())
Ejemplo n.º 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())
Ejemplo n.º 3
0
    def count_of_certain():
        '''
        Get the count of certain kind.
        '''

        recs = TabReply.select()

        return recs.count()
Ejemplo n.º 4
0
 def query_pager(current_page_num=1):
     '''
     Query pager
     '''
     return TabReply.select().paginate(current_page_num,
                                       CMS_CFG['list_num'])
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 7
0
 def query_all():
     return TabReply.select().order_by(TabReply.timestamp.desc())
Ejemplo n.º 8
0
 def get_by_uid(uid):
     recs = TabReply.select().where(TabReply.uid == uid)
     if recs.count():
         return recs.get()
     return None
Ejemplo n.º 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()
Ejemplo n.º 10
0
 def total_number():
     '''
     Return the number.
     '''
     return TabReply.select().count()