Пример #1
0
 def serach_count(self, key):
     q = db.select(self.table).fields(db.expr('count(*)',
             'total')).condition('status', 'published')
     _or = db.or_()
     _or.condition('slug', '%%%s%%' % key, 'LIKE').condition('title', '%%%s%%' % key, 'LIKE')
     q.condition(_or)
     return q.execute()[0][0]
Пример #2
0
 def serach_count(self, key):
     q = db.select(self.table).fields(db.expr('count(*)',
                                              'total')).condition(
                                                  'status', 'published')
     _or = db.or_()
     _or.condition('slug', '%%%s%%' % key,
                   'LIKE').condition('title', '%%%s%%' % key, 'LIKE')
     q.condition(_or)
     return q.execute()[0][0]
Пример #3
0
 def count(self, status=None):
     q = db.select(self.table).fields(db.expr('COUNT(*)'))
     if status:
         q.condition('status', status)
     return q.execute()[0][0]
Пример #4
0
 def category_count(self, category_id):
     return db.select(self.table).fields(db.expr(
         'count(*)', 'total')).condition('category', category_id).condition(
             'status', 'published').execute()[0][0]
Пример #5
0
 def spam_count(self, domain):
     return db.select(self.table).fields(db.expr('COUNT(*)')).condition(
         'email', domain, 'LIKE').execute()[0][0]
Пример #6
0
 def count(self):
     return db.select(self.table).fields(
         db.expr('COUNT(*)')).execute()[0][0]
Пример #7
0
 def count(self, **kw):
     q = db.select(self.table).fields(db.expr('COUNT(*)'))
     if kw:
         for k, v in kw.iteritems():
             q.condition(k, v)
     return q.execute()[0][0]
Пример #8
0
 def count(self):
     return db.select(self.table).fields(db.expr('COUNT(*)')).execute()[0][0]
Пример #9
0
 def count_slug(self, slug):
     return db.select(self.table).fields(db.expr('COUNT(*)')).condition('slug', slug).execute()[0][0]
Пример #10
0
 def count(self, status=None):
     q= db.select(self.table).fields(db.expr('COUNT(*)'))
     if status != 'all':
         q.condition('status', status)
     return q.execute()[0][0]
Пример #11
0
 def category_count(self, category_id):
     return db.select(self.table).fields(db.expr('count(*)',
         'total')).condition('category', category_id).condition('status', 'published').execute()[0][0]
Пример #12
0
 def count(self, **kw):
     q = db.select(self.table).fields(db.expr('COUNT(*)'))
     if kw:
         for k, v in kw.iteritems():
             q.condition(k, v)
     return q.execute()[0][0]
Пример #13
0
 def spam_count(self, domain):
     return db.select(self.table).fields(db.expr('COUNT(*)')).condition('email', domain, 'LIKE').execute()[0][0]