def query_by_postid(postid, limit=5): recs = TabPostHist.select().where( TabPostHist.post_id == postid ).order_by( TabPostHist.time_update.desc() ).limit(limit) return recs
def query_by_postid(postid, limit=5): ''' Query history of certian records. ''' recs = TabPostHist.select().where( TabPostHist.post_id == postid).order_by( TabPostHist.time_update.desc()).limit(limit) return recs
def get_last(postid, limit=10): recs = TabPostHist.select().where( TabPostHist.post_id == postid ).order_by(TabPostHist.time_update.desc()).limit(limit) if recs.count() == 0: return None else: return recs.get()
def get_last(postid, limit=10): ''' Get the last one of the records. ''' recs = TabPostHist.select().where( TabPostHist.post_id == postid).order_by( TabPostHist.time_update.desc()).limit(limit) if recs.count(): return recs.get() return None