Ejemplo n.º 1
0
    def get_by_slug(self, slug):



        tt = CabPage.select().where(CabPage.slug == slug).count()
        if tt == 0:
            return None
        else:
            return CabPage.get(CabPage.slug == slug)
Ejemplo n.º 2
0
    def get_by_slug(self, slug):

        entry = CabPage.update(view_count=CabPage.view_count +
                               1, ).where(CabPage.slug == slug)
        entry.execute()

        tt = CabPage.select().where(CabPage.slug == slug).count()
        if tt == 0:
            return None
        else:
            return CabPage.get(CabPage.slug == slug)
Ejemplo n.º 3
0
    def get_by_slug(self, slug):

        entry = CabPage.update(
            view_count=CabPage.view_count + 1,
        ).where(CabPage.slug == slug)
        entry.execute()

        tt = CabPage.select().where(CabPage.slug == slug).count()
        if tt == 0:
            return None
        else:
            return CabPage.get(CabPage.slug == slug)
Ejemplo n.º 4
0
 def query_by_cat(self, cat_str):
     tt = CabPage.select().where((CabPage.id_cats.contains(str(cat_str))) & ((CabPage.type == 1))).order_by(
         'time_update')
     return tt
Ejemplo n.º 5
0
 def query_recent(self):
     tt = CabPage.select().where(CabPage.type == 1).order_by(CabPage.time_update.desc()).limit(10)
     return tt
Ejemplo n.º 6
0
 def query_by_cat(self, cat_str):
     tt = CabPage.select().where((CabPage.id_cats.contains(str(cat_str))) & ((CabPage.type == 1))).order_by(
         'time_update')
     return tt
Ejemplo n.º 7
0
 def query_all(self):
     return CabPage.select().order_by('time_update')