本文整理汇总了Python中model.Post.content方法的典型用法代码示例。如果您正苦于以下问题:Python Post.content方法的具体用法?Python Post.content怎么用?Python Post.content使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类model.Post
的用法示例。
在下文中一共展示了Post.content方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: post
# 需要导入模块: from model import Post [as 别名]
# 或者: from model.Post import content [as 别名]
def post(self):
post = Post()
post.title = self.request.get('title_input')
post.content = self.request.get('content')
post.tags_commas = self.request.get('tags')
user = users.get_current_user()
post.author = user
post.catalog = self.request.get('blogcatalog')
private = self.request.get('private')
if private:
post.private = True;
else:
post.private = False;
#try: #no need this ugly permalink now!
# permalink = util.get_permalink(post.date,util.translate('zh-CN','en', util.u(post.title,'utf-8')))
# if not permalink:
# raise Exception
#except Exception:
# self.response.out.write("transalte error in title %s = %s<br />\n" % (post.title,util.get_permalink(post.date,util.translate('zh-CN','en', util.u(post.title,'utf-8')))))
# return
#check the permalink duplication problem.
#maxpermalinkBlog = db.GqlQuery("select * from Post where permalink >= :1 and permalink < :2 order by permalink desc",permalink, permalink+u"\xEF\xBF\xBD").get()
#if maxpermalinkBlog is not None:
# permalink = maxpermalinkBlog.permalink+ post.date.strftime('-%Y-%m-%d')
#post.permalink = permalink
post.save()
util.flushCategoryLists()
util.flushArchiveLists()
util.flushTagLists()
util.flushPublicPosts()
return self.redirect(post.full_permalink())
示例2: post
# 需要导入模块: from model import Post [as 别名]
# 或者: from model.Post import content [as 别名]
def post(self):
my_post = Post()
my_post.title = self.get_argument("title")
my_post.content = self.get_argument("content")
my_post.category_id = int(self.get_argument("category"))
my_post.tags = self.get_model_list(
Tag,
**dict(in_=[("id", self.get_arguments("tags"))])
)
my_post.post_time = datetime.now()
self.insert(my_post)
self.redirect("/admin/posts")