I have both simple-friends and notifications running and workign and
have set up notice types.
How do I use signals from friend request for instance to trigger
notice types?
examples
simple-friends:
class FriendshipRequest(models.Model):
from_user = models.ForeignKey(User,
related_name="invitations_from")
to_user = models.ForeignKey(User, related_name="invitations_to")
message = models.CharField(max_length=200, blank=True)
created = models.DateTimeField(default=datetime.datetime.now,
editable=False)
accepted = models.BooleanField(default=False)
class Meta:
verbose_name = _(u'friendship request')
verbose_name_plural = _(u'friendship requests')
unique_together = (('to_user', 'from_user'),)
def __unicode__(self):
return _(u'%(from_user)s wants to be friends with %
(to_user)s') % \
{'from_user': unicode(self.from_user),
'to_user': unicode(self.to_user)}
def accept(self):
Friendship.objects.befriend(self.from_user, self.to_user)
self.accepted = True
self.save()
signals.friendship_accepted.send(sender=self)
def decline(self):
signals.friendship_declined.send(sender=self, cancelled=False)
self.delete()
def cancel(self):
signals.friendship_declined.send(sender=self, cancelled=True)
self.delete()
notifications:
notification.send(Friendship.objects.friends_for_user(self.owner.id),
"listing_new", {'listing':self, }, )
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.