本文整理汇总了Python中models.News.put方法的典型用法代码示例。如果您正苦于以下问题:Python News.put方法的具体用法?Python News.put怎么用?Python News.put使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.News
的用法示例。
在下文中一共展示了News.put方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: post
# 需要导入模块: from models import News [as 别名]
# 或者: from models.News import put [as 别名]
def post(self):
news = News()
news.title = self.request.get("title")
news.slug_title = self.request.get("slug_title")
news.content = self.request.get("content")
news.when_published = datetime.utcnow()
news.put()
self.response.out.write(news.to_json("title", "is_deleted", "is_active", "is_starred"))
示例2: news_post
# 需要导入模块: from models import News [as 别名]
# 或者: from models.News import put [as 别名]
def news_post():
form = NewsForm()
if form.validate_on_submit():
news = News(view = 0, title = form.title.data,url = form.url.data,hot = False)
try:
news.put()
flash(u'저장 성공', 'success')
return redirect(url_for('new_list'))
except CapabilityDisabledError:
flash(u'App Engine Datastore is currently in read-only mode.', 'failure')
return redirect(url_for('new_list'))
return render_template('news_post.html', form=form,title= request.args.get('title'), url= request.args.get('url'))
示例3: news_post
# 需要导入模块: from models import News [as 别名]
# 或者: from models.News import put [as 别名]
def news_post():
form = NewsForm()
if form.validate_on_submit():
news = News(view = 0, title = form.title.data,url = form.url.data,hot = False)
try:
news.put()
search.Index(name=_INDEX_NAME).add(create_doc(news.key.id(),news.title,news.url,news.post_time))
flash(u'저장 성공', 'success')
return redirect(url_for('new_list'))
except CapabilityDisabledError:
flash(u'App Engine Datastore is currently in read-only mode.', 'failure')
return redirect(url_for('new_list'))
return render_template('news_post.html', form=form,title= request.args.get('title'), url= request.args.get('url'),counter=counter.load_and_get_count("view"),acc=ACC)