當前位置: 首頁>>代碼示例>>Python>>正文


Python Comment.findNumber方法代碼示例

本文整理匯總了Python中models.Comment.findNumber方法的典型用法代碼示例。如果您正苦於以下問題:Python Comment.findNumber方法的具體用法?Python Comment.findNumber怎麽用?Python Comment.findNumber使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在models.Comment的用法示例。


在下文中一共展示了Comment.findNumber方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: index

# 需要導入模塊: from models import Comment [as 別名]
# 或者: from models.Comment import findNumber [as 別名]
def index(*, page='1'):
    page_index = get_page_index(page)
    num = yield from Blog.findNumber('count(id)')
    page = Page(num, page_index)
    if num == 0:
        blogs = []
    else:
        blogs = yield from Blog.findAll(orderBy='created_at desc', limit=(page.offset, page.limit))
    # ?????????????????????
    # app.py?response_factory???handler.py??????????
    return {
        '__template__': 'blogs.html',
        'page': page,
        'blogs': blogs
    }


# day11??
# ???????? 
開發者ID:ReedSun,項目名稱:Preeminent,代碼行數:21,代碼來源:handlers.py

示例2: index

# 需要導入模塊: from models import Comment [as 別名]
# 或者: from models.Comment import findNumber [as 別名]
def index(request,*,page='1'):
	page_index = get_page_index(page)
	num = await Blog.findNumber('count(id)')
	page = Page(num,page_index)
	if page == 0:
		blogs = []
	else:
		blogs = await Blog.findAll(orderBy = 'created_at desc',limit=(page.offset,page.limit))
	return{
		'__template__' : 'blogs.html',
		'page' : page,
		'blogs' : blogs,
		'__user__' : request.__user__
	} 
開發者ID:syusonn,項目名稱:awesome-python3-webapp,代碼行數:16,代碼來源:handlers.py

示例3: api_comments

# 需要導入模塊: from models import Comment [as 別名]
# 或者: from models.Comment import findNumber [as 別名]
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) 
開發者ID:syusonn,項目名稱:awesome-python3-webapp,代碼行數:10,代碼來源:handlers.py

示例4: api_get_users

# 需要導入模塊: from models import Comment [as 別名]
# 或者: from models.Comment import findNumber [as 別名]
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',limit=(p.offset,p.limit))
	for u in users:
		u.passwd = '******'
	return dict(page=p,users=users) 
開發者ID:syusonn,項目名稱:awesome-python3-webapp,代碼行數:12,代碼來源:handlers.py

示例5: api_blogs

# 需要導入模塊: from models import Comment [as 別名]
# 或者: from models.Comment import findNumber [as 別名]
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=0,blogs={})
	blogs = await Blog.findAll(orderBy='created_at desc',limit=(p.offset,p.limit))
	return dict(page=p,blogs=blogs) 
開發者ID:syusonn,項目名稱:awesome-python3-webapp,代碼行數:10,代碼來源:handlers.py

示例6: api_blogs

# 需要導入模塊: from models import Comment [as 別名]
# 或者: from models.Comment import findNumber [as 別名]
def api_blogs(*, page='1'):
    page_index = get_page_index(page)
    num = yield from Blog.findNumber('count(id)') # num?????
    p = Page(num, page_index)  # ??Page???Page???apis.py????
    if num == 0:
        return dict(page=p, blogs=())  # ?????0,????,??app.py?response??????
    # ??????0,??????????
    # limit??select??????????,?????????,?????????????
    blogs = yield from Blog.findAll(orderBy='created_at desc', limit=(p.offset, p.limit))
    return dict(page=p, blogs=blogs)  # ????,??response?????

# day14??
# API????? 
開發者ID:ReedSun,項目名稱:Preeminent,代碼行數:15,代碼來源:handlers.py

示例7: api_comments

# 需要導入模塊: from models import Comment [as 別名]
# 或者: from models.Comment import findNumber [as 別名]
def api_comments(*, page='1'):
    page_index = get_page_index(page)
    num = yield from Comment.findNumber('count(id)')  # num?????
    p = Page(num, page_index)  # ??Page?????????
    if num == 0:
        return dict(page=p, comments=())  # ???????????????app.py?response??????
    # ??????0,??????????
    # limit??select??????????,?????????,?????????????
    comments = yield from Comment.findAll(orderBy='created_at desc', limit=(p.offset, p.limit))
    return dict(page=p, comments=comments)

# day14??
# API????? 
開發者ID:ReedSun,項目名稱:Preeminent,代碼行數:15,代碼來源:handlers.py

示例8: index

# 需要導入模塊: from models import Comment [as 別名]
# 或者: from models.Comment import findNumber [as 別名]
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
    } 
開發者ID:xsingHu,項目名稱:xs-python-architecture,代碼行數:15,代碼來源:handlers.py

示例9: api_comments

# 需要導入模塊: from models import Comment [as 別名]
# 或者: from models.Comment import findNumber [as 別名]
def api_comments(*, page='1'):
    page_index = get_page_index(page)
    num = yield from Comment.findNumber('count(id)')
    p = Page(num, page_index)
    if num == 0:
        return dict(page=p, comments=())
    comments = yield from Comment.findAll(orderBy='created_at desc', limit=(p.offset, p.limit))
    return dict(page=p, comments=comments) 
開發者ID:xsingHu,項目名稱:xs-python-architecture,代碼行數:10,代碼來源:handlers.py

示例10: api_get_users

# 需要導入模塊: from models import Comment [as 別名]
# 或者: from models.Comment import findNumber [as 別名]
def api_get_users(*, page='1'):
    page_index = get_page_index(page)
    num = yield from User.findNumber('count(id)')
    p = Page(num, page_index)
    if num == 0:
        return dict(page=p, users=())
    users = yield from User.findAll(orderBy='created_at desc', limit=(p.offset, p.limit))
    for u in users:
        u.passwd = '******'
    return dict(page=p, users=users) 
開發者ID:xsingHu,項目名稱:xs-python-architecture,代碼行數:12,代碼來源:handlers.py

示例11: api_blogs

# 需要導入模塊: from models import Comment [as 別名]
# 或者: from models.Comment import findNumber [as 別名]
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) 
開發者ID:xsingHu,項目名稱:xs-python-architecture,代碼行數:10,代碼來源:handlers.py

示例12: api_get_users

# 需要導入模塊: from models import Comment [as 別名]
# 或者: from models.Comment import findNumber [as 別名]
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', limit=(p.offset, p.limit))
	for u in users:
		u.password = '******'
	return dict(page=p, users=users) 
開發者ID:TsangTen,項目名稱:awesome-webapp,代碼行數:12,代碼來源:handlers.py

示例13: api_blogs

# 需要導入模塊: from models import Comment [as 別名]
# 或者: from models.Comment import findNumber [as 別名]
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) 
開發者ID:TsangTen,項目名稱:awesome-webapp,代碼行數:10,代碼來源:handlers.py

示例14: api_comments

# 需要導入模塊: from models import Comment [as 別名]
# 或者: from models.Comment import findNumber [as 別名]
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) 
開發者ID:TsangTen,項目名稱:awesome-webapp,代碼行數:10,代碼來源:handlers.py

示例15: index

# 需要導入模塊: from models import Comment [as 別名]
# 或者: from models.Comment import findNumber [as 別名]
def index(*, page = '1'):
    page_index = get_page_index(page)
    num = await Blog.findNumber('count(id)')
    page = Page(num, page_index)
    if num == 0:
        blogs = []
    else:
        blogs = await Blog.findAll(orderBy = 'created_at desc', limit = (page.offset, page.limit))
    return {
        '__template__' : 'blogs.html',
        'page' : page,
        'blogs' : blogs
    } 
開發者ID:chenpengcong,項目名稱:python3-webapp,代碼行數:15,代碼來源:handlers.py


注:本文中的models.Comment.findNumber方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。