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


Python Comment.select_all方法代码示例

本文整理汇总了Python中models.Comment.select_all方法的典型用法代码示例。如果您正苦于以下问题:Python Comment.select_all方法的具体用法?Python Comment.select_all怎么用?Python Comment.select_all使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在models.Comment的用法示例。


在下文中一共展示了Comment.select_all方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: get

# 需要导入模块: from models import Comment [as 别名]
# 或者: from models.Comment import select_all [as 别名]
 def get(self):
     params = self.request.url_params
     print params
     category = params[0]
     which = params[1]
     article, comment, comments, user = None, None, None, None
     if category == 'article':
         # delete article and all related comments
         old_article = Article.select_one('created_at=?', which)
         article = old_article
         old_article.delete()
         old_comments = Comment.select_all('article_id=?', article.id)
         comments = old_comments
         if old_comments:
             for comment in old_comments:
                 comment.delete()
     elif category == 'user':
         old_user = User.select_one('id=?', which)
         user = old_user
         old_user.delete()
     elif category == 'comment':
         old_comment = Comment.select_one('id=?', which)
         comment = old_comment
         old_comment.delete()
     return self.render('_delete.html', article=article, comment=comment, \
             comments=comments, user=user)
开发者ID:damnever,项目名称:LTsite,代码行数:28,代码来源:urls.py

示例2: post

# 需要导入模块: from models import Comment [as 别名]
# 或者: from models.Comment import select_all [as 别名]
 def post(self):
     """Comment for about page."""
     comment = self.request.get_argument('comment', '')
     # insert into db, and load page again
     u_id = self.get_current_user()
     user_d = User.select_one('id=?', u_id)
     created_at = int(time.time())
     comment_d = Comment(article_id=222222222, username=user_d.name, \
             content=comment, created_at=created_at)
     comment_d.insert()
     comments = Comment.select_all('article_id=?', 222222222)
     return self.render('about.html', comments=comments)
开发者ID:damnever,项目名称:LTsite,代码行数:14,代码来源:urls.py


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