本文整理匯總了Python中kitsune.forums.events.NewPostEvent.stop_notifying方法的典型用法代碼示例。如果您正苦於以下問題:Python NewPostEvent.stop_notifying方法的具體用法?Python NewPostEvent.stop_notifying怎麽用?Python NewPostEvent.stop_notifying使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類kitsune.forums.events.NewPostEvent
的用法示例。
在下文中一共展示了NewPostEvent.stop_notifying方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: watch_thread
# 需要導入模塊: from kitsune.forums.events import NewPostEvent [as 別名]
# 或者: from kitsune.forums.events.NewPostEvent import stop_notifying [as 別名]
def watch_thread(request, forum_slug, thread_id):
"""Watch/unwatch a thread (based on 'watch' POST param)."""
forum = get_object_or_404(Forum, slug=forum_slug)
if not forum.allows_viewing_by(request.user):
raise Http404
thread = get_object_or_404(Thread, pk=thread_id, forum=forum)
if request.POST.get('watch') == 'yes':
NewPostEvent.notify(request.user, thread)
statsd.incr('forums.watches.thread')
else:
NewPostEvent.stop_notifying(request.user, thread)
return HttpResponseRedirect(reverse('forums.posts',
args=[forum_slug, thread_id]))