def query_by_wikiid(postid, limit=5): recs = TabWikiHist.select().where( TabWikiHist.wiki_id == postid ).order_by( TabWikiHist.time_update.desc() ).limit(limit) return recs
def get_last(postid): ''' Get the last wiki in history. ''' recs = TabWikiHist.select().where( TabWikiHist.wiki_id == postid ).order_by(TabWikiHist.time_update.desc()) return None if recs.count() == 0 else recs.get()