📜  django __in queryset - Python 代码示例

📅  最后修改于: 2022-03-11 14:45:04.739000             🧑  作者: Mango

代码示例1
#SQL equivalents:

SELECT ... WHERE id IN (1, 3, 4);
SELECT ... WHERE headline IN ('a', 'b', 'c');
#You can also use a queryset to dynamically evaluate the list of values instead of providing a list of literal values:
inner_qs = Blog.objects.filter(name__contains='Cheddar')
entries = Entry.objects.filter(blog__in=inner_qs)