當前位置: 首頁>>代碼示例>>Python>>正文


Python Comment.removed方法代碼示例

本文整理匯總了Python中comments.models.Comment.removed方法的典型用法代碼示例。如果您正苦於以下問題:Python Comment.removed方法的具體用法?Python Comment.removed怎麽用?Python Comment.removed使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在comments.models.Comment的用法示例。


在下文中一共展示了Comment.removed方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: update_comment

# 需要導入模塊: from comments.models import Comment [as 別名]
# 或者: from comments.models.Comment import removed [as 別名]
 def update_comment(self):
     """
     Creates the shadow comment object to hold this document's place in a
     commment thread, if this document is a reply to comments.
     """
     # Create comment objects only when the doc is public.  That way,
     # subscription signals are fired at the right moment -- the comment is
     # public and viewable.
     parent = None
     if self.in_reply_to:
         try:
             parent = self.in_reply_to.document
         except Document.DoesNotExist:
             pass
     if parent and self.is_public():
         # Only create a comment object if we are public.
         try:
             comment = self.comment
         except Comment.DoesNotExist:
             comment = Comment()
         comment.user = self.author
         comment.removed = False
         comment.document = parent
         comment.comment_doc = self
         comment.save()
     else:
         # If we've gone non-public, mark the comment removed rather
         # than deleting.  That way, we don't re-fire subscriptions if
         # the doc is only temporarily un-published.
         try:
             self.comment.removed = True
             self.comment.save()
         except Comment.DoesNotExist:
             pass
開發者ID:yourcelf,項目名稱:btb,代碼行數:36,代碼來源:models.py


注:本文中的comments.models.Comment.removed方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。