Haystack django SearchQuerySet

时间:2016-11-11 15:26:33

标签: python django django-haystack

我正在使用 Haystack Django 作为搜索引擎。

SearchQuerySet().filter(**conds)
conds 可能包括:

conds['name'] = Exact(name)
conds['category'] = Exact(category)
conds['city_id'] = Exact(city_id)

但除此之外我还想添加 sub_category列表作为条件,所以有没有办法添加像

这样的东西
conds['sub_category'] = list(city_id)

1 个答案:

答案 0 :(得分:0)

好的,问题似乎不清楚,我的意思是我想将键 sub_category 添加到字典 conds 中,这些值是列表。 所以我发现这种方式可以回答上面的问题:

conds['sub_categary__in']  = sub_category_list
相关问题