Beispiel #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)
Beispiel #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)
Beispiel #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)
Beispiel #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
Beispiel #5
0
 def query_recent(self):
     tt = CabPage.select().where(CabPage.type == 1).order_by(CabPage.time_update.desc()).limit(10)
     return tt
Beispiel #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
Beispiel #7
0
 def query_all(self):
     return CabPage.select().order_by('time_update')