def notify_of_vote(created, **kwargs): vote = kwargs.get("instance") recipient = vote.content.user if created and vote.user != recipient: # Votes on proposals if vote.content_type == Proposal.get_content_type(): if vote.isVoteUp: type = "proposal_vote_up" else: type = "proposal_vote_down" # Votes on comments elif vote.content_type == Comment.get_content_type(): if vote.isVoteUp: type = "comment_vote_up" else: type = "comment_vote_down" Notification.objects.create(recipient=recipient, type=type, content_type=Vote.get_content_type(), object_id=vote.id)