本文整理汇总了Python中models.Project.one方法的典型用法代码示例。如果您正苦于以下问题:Python Project.one方法的具体用法?Python Project.one怎么用?Python Project.one使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.Project
的用法示例。
在下文中一共展示了Project.one方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get
# 需要导入模块: from models import Project [as 别名]
# 或者: from models.Project import one [as 别名]
def get(self, slug):
spec = {'status':'published', 'slug': slug}
project = Project.one(spec)
if not project:
raise tornado.web.HTTPError(404)
project.increment_view_count()
self.render("project", project=project)
示例2: post
# 需要导入模块: from models import Project [as 别名]
# 或者: from models.Project import one [as 别名]
def post(self, slug):
project = Project.one({'slug': slug})
if not project:
raise tornado.web.HTTPError(404)
#project.delete()
project.status = u'deleted'
project.save()
self.set_flash(self._("The project has been removed."))
self.redirect("/projects")
示例3: get
# 需要导入模块: from models import Project [as 别名]
# 或者: from models.Project import one [as 别名]
def get(self, ch):
project = Project.one({'type': CONTENT_TYPE.PROJECT, 'slug': ch})
if not project:
raise tornado.web.HTTPError(404)
recent = MessageMixin.get_recent(ch)
self.render("talk", project=project, messages=recent, ch=ch)