在Django的filter查询中如何执行或操作


可以使用Q对象,Q对象允许执行一些复杂的操作。

例如

from django.db.models import Q

Item.objects.filter(Q(creator=owner) | Q(moderated=False))