本文整理汇总了Python中models.blog.Blog.save_to_mongo方法的典型用法代码示例。如果您正苦于以下问题:Python Blog.save_to_mongo方法的具体用法?Python Blog.save_to_mongo怎么用?Python Blog.save_to_mongo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.blog.Blog
的用法示例。
在下文中一共展示了Blog.save_to_mongo方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _create_new_account
# 需要导入模块: from models.blog import Blog [as 别名]
# 或者: from models.blog.Blog import save_to_mongo [as 别名]
def _create_new_account(self):
title = input("Title of the blog? ")
description = input("Description of the blog? ")
blog = Blog(self.user, title, description)
# no need to create new_post() because we are essentially creating a new account.
blog.save_to_mongo()
self.user_blog = blog
示例2: new_blog
# 需要导入模块: from models.blog import Blog [as 别名]
# 或者: from models.blog.Blog import save_to_mongo [as 别名]
def new_blog(self, title, description):
blog = Blog(author=self.email,
title=title,
description=description,
author_id=self._id)
blog.save_to_mongo()
示例3: _prompt_user_for_account
# 需要导入模块: from models.blog import Blog [as 别名]
# 或者: from models.blog.Blog import save_to_mongo [as 别名]
def _prompt_user_for_account(self):
title = input("Enter blog title: ")
description = input("Enter blog description: ")
blog = Blog(author=self.user,
title=title,
description=description)
blog.save_to_mongo()
self.user_blog = blog
示例4: create_new_blog
# 需要导入模块: from models.blog import Blog [as 别名]
# 或者: from models.blog.Blog import save_to_mongo [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'])
new_blog = Blog(user.email, title, content, user._id)
new_blog.save_to_mongo()
return make_response(user_blogs(user._id))
示例5: new_blog
# 需要导入模块: from models.blog import Blog [as 别名]
# 或者: from models.blog.Blog import save_to_mongo [as 别名]
def new_blog(self, title, description):
''' create new blog '''
#title, description, author, authorId, createdDate=datetime.datetime.utcnow(), _id=None
blog = Blog(title, description, self.email, self._id)
blog.save_to_mongo()