design_list = Design.objects.filter(tags__tag__contains='jewellery')
如果我添加一个过滤器术语(如下),它会返回“关键字参数重复”
design_list = Design.objects.filter(tags__tag__contains='jewellery', tags__tag__contains='gadget')
如何添加更多条款?
design_list = Design.objects.filter(tags__tag__contains='jewellery')
如果我添加一个过滤器术语(如下),它会返回“关键字参数重复”
design_list = Design.objects.filter(tags__tag__contains='jewellery', tags__tag__contains='gadget')
如何添加更多条款?
您必须使用Q
对象才能进行OR
查询:
from django.db.models import Q
Design.objects.filter(Q(tags__tag__contains = "jewellery") | Q(tags__tag__contains = "gadget"))