def api_blogs(*,page='1'):
    page_index = get_page_index(page)
    num = yield from Blog.findNumber('count(id)')
    p = Page(num,page_index)
    if num == 0:
        return dict(page=p,blogs = ())
    blogs = yield from Blog.findAll(orderBy='created_at desc',limit=(p.offset,p.limit))
    return dict(page = p,blogs=blogs)
Esempio n. 2
0
def api_blogs(*, page='1'):
    page_index = get_page_index(page)
    num = yield from Blog.findNumber('count(id)')
    p = Page(num, page_index)
    if num == 0:
        return dict(page=p, blogs=())
    blogs = yield from Blog.findAll(orderBy='created_at desc', limit=(p.offset, p.limit))
    return dict(page=p, blogs=blogs)
def index(request):

    blogs= yield from  Blog.findAll()

    return {
        '__template__': 'blogs.html',
        'blogs': blogs,
        '__user__':request.__user__
    }
Esempio n. 4
0
def index(*, page='1'):
    page_index = get_page_index(page)
    num = yield from Blog.findNumber('count(id)')
    page = Page(num)
    if num == 0:
        blogs = []
    else:
        blogs = yield from Blog.findAll(orderBy='created_at desc',
                                        limit=(page.offset, page.limit))
    return {'__template__': 'blogs.html', 'page': page, 'blogs': blogs}
Esempio n. 5
0
def index(*, page='1'):
	page_index = get_page_index(page)
	num = yield from Blog.findNumber('count(id)')
	page = Page(num)
	if num == 0:
		blogs = []
	else:
		blogs = yield from Blog.findAll(orderBy='created_at desc', limit=(page.offset, page.limit))
	return {
		'__template__': 'blogs.html',
		'page': page,
		'blogs': blogs
	}
Esempio n. 6
0
def index(request):
	# users = yield from User.findAll()
	# if request.__user__:
	# 	user = request.__user__
	# else:
	# 	user = None
	blogs = yield from Blog.findAll()
	return {
		'__template__': 'blogs.html',
		#'users':users
		'blogs': blogs
		# 'user': user
	}
def handler_url_blogs(request):
    blogs = yield from  Blog.findAll()
    return {
        '__template__':'blogs.html',
        'blogs':blogs
    }