示例#1
0
def get_user_replies(tid, page):
    topic = get_topic(tid)
    page_obj = Reply.query.filter(Reply.tid==tid)
    page_obj = page_obj.order_by(desc(Reply.time))
    items = page_obj.limit(PAGE_NUM).offset((page - 1) * PAGE_NUM).all()
    page_obj = Pagination(page_obj, page, PAGE_NUM, topic.reply_count, items)
    return gen_list_page_obj(page_obj)
示例#2
0
def get_user_topics(uid, page):
    meta = get_user_topic_meta(uid)
    if not meta:
        meta = set_user_topic_meta(uid)
    page_obj = UserTopic.query.filter(and_(UserTopic.uid==uid, UserTopic.has_delete==0))
    page_obj = page_obj.order_by(desc(UserTopic.last_time))
    items = page_obj.limit(PAGE_NUM).offset((page - 1) * PAGE_NUM).all()
    page_obj = Pagination(page_obj, page, PAGE_NUM, meta.topic_count, items)
    ret = gen_list_page_obj(page_obj)
    ret.last_time = meta.last_time
    return ret