开发者

Sending notifications to your Friends in Pinax, Django

开发者 https://www.devze.com 2023-02-01 05:01 出处:网络
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?

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, }, )
0

精彩评论

暂无评论...
验证码 换一张
取 消