Skip to content

Instantly share code, notes, and snippets.

@drager
Created June 11, 2014 10:16
Show Gist options
  • Save drager/679c829ceb49d4873d48 to your computer and use it in GitHub Desktop.
Save drager/679c829ceb49d4873d48 to your computer and use it in GitHub Desktop.
# -*- coding: utf-8 -*-
from django.template.defaultfilters import slugify
from django.core.urlresolvers import reverse
from notifications import notify
def notify_topic_subscribers(post):
topic = post.topic
for user in topic.subscribers.all():
if user != post.author and user != post.topic.author:
notify.send(post.author, recipient=user,
verb=u'gjorde ett inlägg i tråden', action_object=post.topic,
description=post.bodytext, target=post.topic,
actions={'href': reverse('forum:topic_detail',
args=(post.topic.forum.slug, post.topic.id, post.topic.slug)) + "#post" + str(post.id)})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment