async def api_datasource_findAll(*, page='1'): page_index = get_page_index(page) num = await DataSource.findNumber('count(id)') p = Page(num, page_index) if num == 0: return dict(page=p, comments=()) datasources = await DataSource.findAll(orderBy='created_at desc', limit=(p.offset, p.limit)) return dict(page=p, datasources=datasources)
async def api_blogs(*, page='1'): page_index = get_page_index(page) num = await Blog.findNumber('count(id)') p = Page(num, page_index) if num == 0: return dict(page=p, blogs=()) blogs = await Blog.findAll(orderBy='created_at desc', limit=(p.offset, p.limit)) return dict(page=p, blogs=blogs)
async def api_comments(*, page='1'): page_index = get_page_index(page) num = await Comment.findNumber('count(id)') p = Page(num, page_index) if num == 0: return dict(page=p, comments=()) comments = await Comment.findAll(orderBy='created_at desc', limit=(p.offset, p.limit)) return dict(page=p, comments=comments)
async def api_get_users(*, page='1'): page_index = get_page_index(page) num = await User.findNumber('count(id)') p = Page(num, page_index) if num == 0: return dict(page=p, users=()) users = await User.findAll(orderBy='created_at desc') for u in users: u.passwd = '******' return dict(page=p, users=users)
def manage_resources_domain(*, page='1'): return { '__template__': 'resources_domain.html', 'page_index': get_page_index(page) }
def manage_metadata(*, page='1'): return { '__template__': 'metadata.html', 'page_index': get_page_index(page) }
def manage_datasources(*, page='1'): return { '__template__': 'datasources.html', 'page_index': get_page_index(page) }
def manage_comments(*, page='1'): return { '__template__': 'manage_comments.html', 'page_index': get_page_index(page) }