def watch_forum(request, forum_slug): """Watch/unwatch a forum (based on 'watch' POST param).""" forum = get_object_or_404(Forum, slug=forum_slug) if not forum.allows_viewing_by(request.user): raise Http404 if request.POST.get('watch') == 'yes': NewThreadEvent.notify(request.user, forum) else: NewThreadEvent.stop_notifying(request.user, forum) return HttpResponseRedirect(reverse('forums.threads', args=[forum_slug]))
def test_delete_removes_watches(self): f = Forum.objects.get(pk=1) NewThreadEvent.notify('*****@*****.**', f) assert NewThreadEvent.is_notifying('*****@*****.**', f) f.delete() assert not NewThreadEvent.is_notifying('*****@*****.**', f)
def test_delete_removes_watches(self): f = forum(save=True) NewThreadEvent.notify('*****@*****.**', f) assert NewThreadEvent.is_notifying('*****@*****.**', f) f.delete() assert not NewThreadEvent.is_notifying('*****@*****.**', f)