Example #1
0
def add_page(page_id, name):
    page_id = int(page_id)
    if page_id:
        page = Page.load(page_id=page_id)
        if page:
            page.updated_time = datetime.datetime.now()
    else:
        page = Page()
        page.created_time = datetime.datetime.now()
        page.updated_time = datetime.datetime.now()
    page.name = name
    page.persist()
Example #2
0
def get_page_all_list(user_id):
    new_pages = []
    pages = Page.query()
    for p in pages:
        if not p:
            continue
        user_page = UserPage.load(user_id=int(user_id), page_id=p.page_id)
        if user_page:
            p.user_page_id = user_page.user_page_id
            p.value = user_page.value
            new_pages.append(p)
        else :
            p.user_page_id = 0
            p.value = 0
            new_pages.append(p)            
    return new_pages
Example #3
0
def get_page_list(page=1,pagesize=20):
    return Page.paging(page, pagesize)