本文整理匯總了Python中notification.models.Notification.create_for_comment方法的典型用法代碼示例。如果您正苦於以下問題:Python Notification.create_for_comment方法的具體用法?Python Notification.create_for_comment怎麽用?Python Notification.create_for_comment使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類notification.models.Notification
的用法示例。
在下文中一共展示了Notification.create_for_comment方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: __update_comment_and_save
# 需要導入模塊: from notification.models import Notification [as 別名]
# 或者: from notification.models.Notification import create_for_comment [as 別名]
def __update_comment_and_save(self, comment, form, submit):
is_form_valid = form.is_valid()
if 'body' in form.cleaned_data:
comment.body = form.cleaned_data['body']
if is_form_valid and submit == 'save':
comment.is_draft = False
comment.save()
notification = Notification.create_for_comment(comment)
if notification.owner != comment.owner:
notification.save()
else:
comment.save()
return is_form_valid