Django object multiple exclude()

后端 未结 5 2185
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-30 22:20

Is there a way to do a query and exclude a list of things, instead of calling exclude multiple times?

5条回答
  •  长发绾君心
    2020-12-30 22:57

    You can try this also.

    exclude_list = ['A', 'B', 'C'] qs = Foo.objects.exclude(items__in=exclude_list)

提交回复
热议问题