0
design_list = Design.objects.filter(tags__tag__contains='jewellery')

如果我添加一个过滤器术语(如下),它会返回“关键字参数重复”

design_list = Design.objects.filter(tags__tag__contains='jewellery', tags__tag__contains='gadget')

如何添加更多条款?

4

1 回答 1

1

您必须使用Q对象才能进行OR查询:

from django.db.models import Q
Design.objects.filter(Q(tags__tag__contains = "jewellery") | Q(tags__tag__contains = "gadget"))
于 2012-10-25T20:03:59.000 回答