0

目前,我正在向数据库中的所有用户发送通知。如何获取我所有朋友的列表,以便将通知发送给我所有的朋友?

if new and notification:
    notification.send(User.objects.all().exclude(id=self.owner.id),
                "listing_new",
                {'listing':self, },
            )
4

1 回答 1

1

你可以试试:

from friends.models import Friendship
if new and notification:
    notification.send(Friendship.objects.friends_for_user(self.owner.id), "listing_new", {'listing':self, }, )
于 2011-01-22T05:15:13.673 回答