本文整理汇总了Python中models.comment.Comment.get方法的典型用法代码示例。如果您正苦于以下问题:Python Comment.get方法的具体用法?Python Comment.get怎么用?Python Comment.get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.comment.Comment
的用法示例。
在下文中一共展示了Comment.get方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_get_comments_by_card_id
# 需要导入模块: from models.comment import Comment [as 别名]
# 或者: from models.comment.Comment import get [as 别名]
def test_get_comments_by_card_id(self):
uid0 = User.add("test1", "password", "[email protected]")
bid0 = Board.add("board1", "A")
lid0 = List.add("To Do", bid0)
caid0 = Card.add("card1", lid0, uid0)
caid1 = Card.add("card2", lid0, uid0)
coid0 = Comment.add(caid0, uid0, "comment1")
coid1 = Comment.add(caid1, uid0, "comment2")
comment0 = Comment.get(coid0)
comment1 = Comment.get(coid1)
assert coid0 in [comment.id for comment in Comment.get_comments_by_card_id(caid0)]
assert coid1 not in [comment.id for comment in Comment.get_comments_by_card_id(caid0)]
示例2: post
# 需要导入模块: from models.comment import Comment [as 别名]
# 或者: from models.comment.Comment import get [as 别名]
def post(self, slug=None):
try:
linkcheck = self.request.get_all('checks')
for key in linkcheck:
comment = Comment.get(key)
comment.delit()
finally:
self.redirect('/admin/comments')
示例3: test_add_and_get
# 需要导入模块: from models.comment import Comment [as 别名]
# 或者: from models.comment.Comment import get [as 别名]
def test_add_and_get(self):
uid0 = User.add("test1", "password", "[email protected]")
bid0 = Board.add("board1", "A")
lid0 = List.add("To Do", bid0)
caid0 = Card.add("card1", lid0, uid0)
coid0 = Comment.add(caid0, uid0, "comment1")
comment0 = Comment.get(coid0)
assert caid0 == comment0.card_id
assert uid0 == comment0.user_id
assert "comment1" == comment0.content
示例4: delete
# 需要导入模块: from models.comment import Comment [as 别名]
# 或者: from models.comment.Comment import get [as 别名]
def delete(self, content_id, comment_id):
comment = Comment.get(int(comment_id))
comment.delete()
self.redirect('/content/' + content_id + "?action=comment.delete")
示例5: comment_delete
# 需要导入模块: from models.comment import Comment [as 别名]
# 或者: from models.comment.Comment import get [as 别名]
def comment_delete(blog_id, comment_id):
comment = Comment.get(comment_id)
comment.delete()
return redirect(url_for('blog_show',blog_id = blog_id))