2013-06-25 78 views
2

我有一个列表过滤器没有在Python

customers=Customers.objects.filter(limit=1) 

level1=customers.filter(status=1) 

level2=customers.filter(status=2) 

我想填充它必须具有在customers所有客户的名称,但不是在level1level2

我已经尝试了第三个列表这么多

returned=customers.filter(~level1) 

回答

2

您可以使用exclude()

Customers.objects.exclude(status__in=[1,2]) 

Customers.objects.filter(whatever=whatever).exclude(status__in=[1,2])