本文整理汇总了Python中src.models.user.User.get_by_email方法的典型用法代码示例。如果您正苦于以下问题:Python User.get_by_email方法的具体用法?Python User.get_by_email怎么用?Python User.get_by_email使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类src.models.user.User
的用法示例。
在下文中一共展示了User.get_by_email方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: user_blogs
# 需要导入模块: from src.models.user import User [as 别名]
# 或者: from src.models.user.User import get_by_email [as 别名]
def 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_blogs.html', blogs=blogs, email=user.email)
示例2: tester_method
# 需要导入模块: from src.models.user import User [as 别名]
# 或者: from src.models.user.User import get_by_email [as 别名]
def tester_method():
email=request.form['email']
print(email)
user=User.get_by_email(email)
Database.update("users",{"email":email},{"printdata":"no"})
return "done"
示例3: test_method
# 需要导入模块: from src.models.user import User [as 别名]
# 或者: from src.models.user.User import get_by_email [as 别名]
def test_method():
email=request.form['email']
print(email)
user=User.get_by_email(email)
print (user.json())
k=user.json()
k['_id']=str(k['_id'])
return jsonify({"status":k['printdata']})
示例4: create_new_blog
# 需要导入模块: from src.models.user import User [as 别名]
# 或者: from src.models.user.User import get_by_email [as 别名]
def create_new_blog():
if request.method=='GET':
return render_template('new_blog.html')
else:
title=request.form['title']
description=request.form['description']
user=User.get_by_email(session['email'])
blog=Blog(user.email,title,description,user._id)
blog.save_to_mongo()
return make_response(user_blogs(user._id))
示例5: create_new_post
# 需要导入模块: from src.models.user import User [as 别名]
# 或者: from src.models.user.User import get_by_email [as 别名]
def create_new_post(blog_id):
if request.method=='GET':
return render_template('new_post.html',blog_id=blog_id)
else:
title=request.form['title']
content=request.form['content']
user=User.get_by_email(session['email'])
new_post=Post(blog_id,title,content,user.email)
new_post.save_to_mongo()
return make_response(blog_posts(blog_id))
示例6: create_new_blog
# 需要导入模块: from src.models.user import User [as 别名]
# 或者: from src.models.user.User import get_by_email [as 别名]
def create_new_blog():
#user came in directly from a url; so show them the create new from
if request.method == 'GET':
return render_template('new_blog.html')
else:
title= request.form['title']
description= request.form['description']
user = User.get_by_email(session['email'])
new_blog=Blog(user.email, title, description, user._id)
new_blog.save_to_mongo()
#the below returns or calls user_blogs
return make_response(user_blogs(user._id))
示例7: create_new_post
# 需要导入模块: from src.models.user import User [as 别名]
# 或者: from src.models.user.User import get_by_email [as 别名]
def create_new_post(blog_id):
#user came in directly from a url; so show them the create new from
if request.method == 'GET':
return render_template('new_post.html', blog_id=blog_id)
else:
title= request.form['title']
content= request.form['content']
user = User.get_by_email(session['email'])
new_post = Post(blog_id, title, content, user.email)
new_post.save_to_mongo()
print(blog_id)
#the below returns or calls user_blogs
return make_response(blog_posts(blog_id))
示例8: eigth_question
# 需要导入模块: from src.models.user import User [as 别名]
# 或者: from src.models.user.User import get_by_email [as 别名]
def eigth_question():
email = session['email']
username = User.get_by_email(email)
return render_template('ques8.html', user = username.email, id = username.score_id)
示例9: get_all_scores
# 需要导入模块: from src.models.user import User [as 别名]
# 或者: from src.models.user.User import get_by_email [as 别名]
def get_all_scores(_id):
email = session['email']
username = User.get_by_email(email)
scores = Score.get_from_mongo_score(_id)
return render_template('score_list.html', scores = scores, user = username.email, id = username._id)