本文整理汇总了Python中models.users.User.get_by_email方法的典型用法代码示例。如果您正苦于以下问题:Python User.get_by_email方法的具体用法?Python User.get_by_email怎么用?Python User.get_by_email使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.users.User
的用法示例。
在下文中一共展示了User.get_by_email方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_all_user_blogs
# 需要导入模块: from models.users import User [as 别名]
# 或者: from models.users.User import get_by_email [as 别名]
def get_all_user_blogs(user_id=None):
if user_id is not None:
user = User.get_by_id(user_id)
else:
user = User.get_by_email(session['email'])
blogs = user.get_blogs()
return render_template('/user_page/user_blogs.html', blogs=blogs, email=user._email)
示例2: create_new_post
# 需要导入模块: from models.users import User [as 别名]
# 或者: from models.users.User import get_by_email [as 别名]
def create_new_post(blog_id):
if request.method == 'GET':
return render_template('/user_page/new_post.html', blog_id=blog_id)
else:
title = request.form['title']
content = request.form['description']
user = User.get_by_email(session['email'])
new_post = Post(blog_id, title, content, user._email)
new_post.save()
return make_response(get_all_user_posts(blog_id))
示例3: create_new_blog
# 需要导入模块: from models.users import User [as 别名]
# 或者: from models.users.User import get_by_email [as 别名]
def create_new_blog():
if request.method == 'GET':
return render_template('/user_page/new_blog.html')
else:
title = request.form['title']
descr = request.form['description']
user = User.get_by_email(session['email'])
new_blog = Blog(user._email, title, descr, user._id)
new_blog.save()
return make_response(get_all_user_blogs(user._id))
示例4: register_user
# 需要导入模块: from models.users import User [as 别名]
# 或者: from models.users.User import get_by_email [as 别名]
def register_user():
if request.method == 'GET':
return render_template('/register/register.html')
else:
email = request.form['email']
passwd = request.form['password']
if User.get_by_email(email):
return 'user already exists'
else:
User.register(email, passwd)
return render_template('/user_page/user_profile_page.html', email=session['email'])