def get_by_wiki(self, citiao): tt = CabWiki.select().where(CabWiki.title == citiao).count() if tt == 0: return None else: self.update_view_count(citiao) return CabWiki.get(CabWiki.title == citiao)
def get_by_wiki(self, citiao): q_res = CabWiki.select().where(CabWiki.title == citiao) tt = q_res.count() if tt == 0 or tt > 1: return None else: self.update_view_count(citiao) return q_res.get()
def query_most(self, num=8): return CabWiki.select().order_by(CabWiki.view_count.desc()).limit(num)
def query_dated(self, num = 10): return CabWiki.select().order_by(CabWiki.time_update.desc()).limit(num)