Currently, I am sending notifications to all Users in the database. How can I get the list of all my friends, so then notifications would be sent to all my friends?
if new and notification:
notification.send(User.objects.all().exclude(id=s开发者_JAVA百科elf.owner.id),
"listing_new",
{'listing':self, },
)
You can try:
from friends.models import Friendship
if new and notification:
notification.send(Friendship.objects.friends_for_user(self.owner.id), "listing_new", {'listing':self, }, )
精彩评论