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


Python Blog.save_to_mongo方法代码示例

本文整理汇总了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
开发者ID:CodeAmend,项目名称:terminal-blog,代码行数:9,代码来源:menu.py

示例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()
开发者ID:wmsgood,项目名称:Mongoblog,代码行数:9,代码来源:user.py

示例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
开发者ID:jinesh-patel,项目名称:terminal_blog,代码行数:10,代码来源:menu.py

示例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))
开发者ID:asimonia,项目名称:web-blog,代码行数:14,代码来源:app.py

示例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()
开发者ID:tuannvm,项目名称:flask,代码行数:7,代码来源:user.py


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