Python models.User 模块,findNumber() 实例源码

我们从Python开源项目中,提取了以下16个代码示例,用于说明如何使用models.User.findNumber()

项目:awesome-python3-webapp    作者:syusonn    | 项目源码 | 文件源码
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__
    }
项目:awesome-python3-webapp    作者:syusonn    | 项目源码 | 文件源码
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)
项目:awesome-python3-webapp    作者:syusonn    | 项目源码 | 文件源码
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)
项目:awesome-python3-webapp    作者:syusonn    | 项目源码 | 文件源码
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)
项目:pythonORM    作者:wlixcc    | 项目源码 | 文件源码
def find():
    await orm.create_pool(loop, user='root', password='password', db='awesome')
    all = await User.findAll()
    print(all)
    pk = await User.find('00149276202953187d8d3176f894f1fa82d9caa7d36775a000')
    print(pk)
    num = await User.findNumber('email')
    print(num)
    await orm.destory_pool()
项目:xs-python-architecture    作者:xsingHu    | 项目源码 | 文件源码
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
    }
项目:xs-python-architecture    作者:xsingHu    | 项目源码 | 文件源码
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)
项目:xs-python-architecture    作者:xsingHu    | 项目源码 | 文件源码
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)
项目:xs-python-architecture    作者:xsingHu    | 项目源码 | 文件源码
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)
项目:awesome-webapp    作者:TsangTen    | 项目源码 | 文件源码
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)
项目:awesome-webapp    作者:TsangTen    | 项目源码 | 文件源码
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)
项目:awesome-webapp    作者:TsangTen    | 项目源码 | 文件源码
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)
项目:python3-webapp    作者:chenpengcong    | 项目源码 | 文件源码
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
    }
项目:python3-webapp    作者:chenpengcong    | 项目源码 | 文件源码
def api_comments(*, page = '1'):
    '''
    ??????, ????manage_comments.html.
    '''
    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)
项目:python3-webapp    作者:chenpengcong    | 项目源码 | 文件源码
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)
项目:python3-webapp    作者:chenpengcong    | 项目源码 | 文件源码
def api_blogs(*, page = '1'):
    '''
    ????????, ????manage_blogs.html.
    '''
    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)