1👍
you should be able to do:
(with user u)
users_objects = sorted(Ownership.objects.filter(user=u), key=lambda x:Ownership.objects.filter(item=x.item, user__in=u.friends).count())
Source:stackexchange.com
1👍
you should be able to do:
(with user u)
users_objects = sorted(Ownership.objects.filter(user=u), key=lambda x:Ownership.objects.filter(item=x.item, user__in=u.friends).count())