当前位置: 首页>>代码示例>>Python>>正文


Python Author.get方法代码示例

本文整理汇总了Python中models.Author.get方法的典型用法代码示例。如果您正苦于以下问题:Python Author.get方法的具体用法?Python Author.get怎么用?Python Author.get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在models.Author的用法示例。


在下文中一共展示了Author.get方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: get_auth_user

# 需要导入模块: from models import Author [as 别名]
# 或者: from models.Author import get [as 别名]
def get_auth_user():
    userid = request.get_cookie("user", secret=SECRET)
    try:
        user = Author.get(id=userid)
    except Author.DoesNotExist:
        return None
    return user
开发者ID:iTriumph,项目名称:MiniAkio,代码行数:9,代码来源:utils.py

示例2: admin_index

# 需要导入模块: from models import Author [as 别名]
# 或者: from models.Author import get [as 别名]
def admin_index():
    post_count = Post.select().count()
    comm_count = Comment.select().count()
    tag_count = Tag.select().count()
    cate_count = Category.select().count()
    author = Author.get(id=1)
    posts = Post.select().paginate(1, 5)
    comments = Comment.select().order_by(('published', 'desc')).paginate(1, 5)
    return template('admin/index.html', posts=posts, comments=comments,
                    post_count=post_count, comm_count=comm_count,
                    tag_count=tag_count, cate_count=cate_count, author=author)
开发者ID:iTriumph,项目名称:MiniAkio,代码行数:13,代码来源:admin.py

示例3: post_admin_login

# 需要导入模块: from models import Author [as 别名]
# 或者: from models.Author import get [as 别名]
def post_admin_login():
    email = request.forms.get('email').decode('utf-8')
    password = request.forms.get('password').decode('utf-8')
    try:
        user = Author.get(email=email)
    except Author.DoesNotExist:
        redirect('/auth/login')
    enpass = user.password
    if is_password(password, enpass):
        response.set_cookie("user", user.id, secret=SECRET, path="/",
                            max_age=30 * 24 * 60 * 60)
        redirect('/admin')
    else:
        redirect('/auth/login')
开发者ID:iTriumph,项目名称:MiniAkio,代码行数:16,代码来源:common.py

示例4: admin_changepass

# 需要导入模块: from models import Author [as 别名]
# 或者: from models.Author import get [as 别名]
def admin_changepass():
    oldpass = request.forms.get('oldpass').decode('utf-8')
    pass1 = request.forms.get('newpass').decode('utf-8')
    pass2 = request.forms.get('newpass2').decode('utf-8')
    try:
        user = Author.get(id=1)
    except Author.DoesNotExist:
        redirect('/admin')
    enpass = user.password
    if (is_password(oldpass, enpass) and pass1 == pass2):
        newpass = hexpassword(pass1)
        Author.update(password=newpass).where(id=1).execute()
        redirect('/admin')
    redirect('/admin/settings')
开发者ID:iTriumph,项目名称:MiniAkio,代码行数:16,代码来源:admin.py

示例5: admin_settings

# 需要导入模块: from models import Author [as 别名]
# 或者: from models.Author import get [as 别名]
def admin_settings():
    author = Author.get(id=1)
    return template('admin/settings.html', author=author)
开发者ID:iTriumph,项目名称:MiniAkio,代码行数:5,代码来源:admin.py


注:本文中的models.Author.get方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。