我试图这样做:
wider_circle = # some queryset
friends_you_may_know = list(wider_circle.exclude(user_id__in=user.connections))
但是我收到了这个错误:
RemovedInDjango19Warning: Passing callable arguments to queryset is deprecated
它适用于Django 1.6,但在1.8
时抛出错误谢谢:)
答案 0 :(得分:4)
我假设connections
在用户模型上是多对多的。这意味着user.connections
是相关经理的实例。您应该尝试传递queryset
实例,即:
friends_you_may_know = list(wider_circle.exclude(user_id__in=user.connections.all()))