Andru Asked:2020-10-08 13:48:32 +0000 UTC2020-10-08 13:48:32 +0000 UTC 2020-10-08 13:48:32 +0000 UTC 如何在 django 中获取 id 不包含在集合中的记录? 772 有一个带有问题的模型,您需要获取其中 answer_id 为空且 id 不等于集合中的任何值的记录。怎么做? python 1 个回答 Voted Best Answer Alex78191 2020-10-08T13:53:48Z2020-10-08T13:53:48Z test_ids = Subject.objects.all() result = Test.objects.filter(test_id__in=test_ids).filter(filter(test_id__isnull=False)) https://docs.djangoproject.com/en/1.10/ref/models/querysets/#in
https://docs.djangoproject.com/en/1.10/ref/models/querysets/#in