def handle(self, sender, signal, **kwargs):
# only add things to the activity stream if there's a user
if kwargs.get("user", None) is None:
return
target = self.getTargetObj(**kwargs)
# invalidate cache for target followers
users = followers(target)
for user in users:
update_activity_stream_for_user.delay(user.username)
update_activity_stream_for_user.delay(kwargs['user'].username, actor=True)
if signal == signals.create:
action.send(kwargs['user'], verb=self.createVerb, action_object=kwargs['instance'], target=target)
if signal == signals.modify:
action.send(kwargs['user'], verb=self.modifyVerb, action_object=kwargs['instance'], target=target)
评论列表
文章目录